Skip to content
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

🐛 BUG: ESM Style config does not work #3869

Open
1 task done
dsheng3 opened this issue Feb 21, 2022 · 0 comments
Open
1 task done

🐛 BUG: ESM Style config does not work #3869

dsheng3 opened this issue Feb 21, 2022 · 0 comments

Comments

@dsheng3
Copy link

dsheng3 commented Feb 21, 2022

Quick checklist

  • I am using the latest version of Snowpack and all plugins.

What package manager are you using?

npm

What operating system are you using?

Windows

Describe the bug

The ESM-style example config leads to an error. The CommonJS-Style, which is created by snowpack init works fine.

npm run start

leads to

export default {
^^^^^^

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.<anonymous> (node:internal/modules/esm/translators:190:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)

Steps to reproduce

  1. Follow the getting-started guide https://www.snowpack.dev/tutorials/getting-started until npm run start
  2. Add ESM-style snowpack.config.js as in https://www.snowpack.dev/reference/configuration
// Example: snowpack.config.mjs
// The added "@type" comment will enable TypeScript type information via VSCode, etc.

/** @type {import("snowpack").SnowpackUserConfig } */
export default {
  plugins: [
    /* ... */
  ],
};
  1. npm run start fails with error message Unexpected token 'export' ...
  2. Expected: no error and same behavior as in step 1.

Link to minimal reproducible example (optional)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant