-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vite build fails with [SyntaxError: Unexpected token 'export'] #46
Comments
Please provide some minimal project with failed build. It can be a bug in my project, bug in Vite, or mistake in build configuration. Vite also has 2 versions right now. Without minimal project I can't reproduce this error and have to close this issue. Thanks. |
Thank you! I will prepare a minimal project shortly. |
Minimal project: |
Thanks. Vite wants ES6 build. I will do it in v2. Sorry, but too much to do to fix v1. v2 is coming in the future. For now you can try import controls like
|
Should fix also #31 |
The proposed temporary solution worked out - thanks! |
All code is ES6 now. Hope Vite will not give any errors. |
(node:87751) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
/some/folder/node_modules/mapbox-gl-controls/lib/index.js:1
export { default as CompassControl } from './CompassControl/CompassControl';
^^^^^^
SyntaxError: Unexpected token 'export'
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap. (node:internal/modules/esm/translators:196:29)
at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
at async Loader.import (node:internal/modules/esm/loader:178:24)
at async Promise.all (index 1)
[SyntaxError: Unexpected token 'export']
The text was updated successfully, but these errors were encountered: