-
Notifications
You must be signed in to change notification settings - Fork 150
Closed
Description
Reproduce
Run:
rails new rollup_error -j rollup
You'll see:
.
.
.
Add build script
run npm set-script build "rollup -c rollup.config.js" from "."
npm WARN set-script set-script is deprecated, use `npm pkg set scripts.scriptname="cmd" instead.
run yarn build from "."
yarn run v1.22.18
$ rollup -c rollup.config.js
(node:62187) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
[!] RollupError: Node tried to load your configuration file as CommonJS even though it is likely an ES module. To resolve this, change the extension of your configuration to ".mjs", set "type": "module" in your package.json file or pass the "--bundleConfigAsCjs" flag.
Original error: Cannot use import statement outside a module
https://rollupjs.org/guide/en/#--bundleconfigascjs
/Users/me/ws/tzif.io/hix/tryouts/rollup_error/rollup.config.js:1
import resolve from "@rollup/plugin-node-resolve"
^^^^^^
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.<anonymous> (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)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
.
.
.
OS:
- Ruby: 3.1.2
- Rails: 7.0.4
- Node: 16.17.0
- Yarn: 1.22.18
Metadata
Metadata
Assignees
Labels
No labels