Closed IsraelDCastro closed 2 years ago
You have to use import statement inside <script>
tag š Will this fix?
<script setup>
import ButtonGroup from './ButtonGroup.vue'
</script>
<ButtonGroup ... />
@kiaking thank you, It worked, but it was not the idea I had.
My idea was to use one unique import from an index.js file for each component. As you can see below in the image. But for the moment I will let in that way.
In order to do that, you need to create share-button-links/components/buttons/index.js
file and export all component there. Then your syntax will work š
Describe the bug
I try to use a library called
share-buttons-links
, and when I run the project locally everything works without any problem, when I try to make a build of the project I get this error:import ButtonGroup from './ButtonGroup.vue'; ^^^^^^
SyntaxError: Cannot use import statement outside a module
SyntaxError: Cannot use import statement outside a module at Object.compileFunction (node:vm:360:18) at wrapSafe (node:internal/modules/cjs/loader:1078:15) at Module._compile (node:internal/modules/cjs/loader:1113:27) at Module._extensions..js (node:internal/modules/cjs/loader:1203:10) at Module.load (node:internal/modules/cjs/loader:1027:32) at Module._load (node:internal/modules/cjs/loader:868:12) at ModuleWrap. (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:526:24)
Before the error said I had to add
"type": "module", but the error still persist, I changed the
postcss.config.jsto
.cjsfile and
tailwind.config.jsto
.cjs`.Reproduction
Happen when I run
yarn docs:build
Expected behavior
I expect the project builds successfully and run
yarn build:serve
to test the production mode and deploy in Netlify.System Info
Additional context
No response
Validations