Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

@pika/plugin-build-web errors out on dynamic imports #155

Open
rafamel opened this issue Mar 25, 2021 · 0 comments
Open

@pika/plugin-build-web errors out on dynamic imports #155

rafamel opened this issue Mar 25, 2021 · 0 comments

Comments

@rafamel
Copy link

rafamel commented Mar 25, 2021

Dynamic imports (import('./foo').then(...)) error out with @pika/plugin-build-web:

Error: You must set "output.dir" instead of "output.file" when generating multiple chunks.
    at error (node_modules/rollup/dist/shared/node-entry.js:5400:30)
    at normalizeOutputOptions (node_modules/rollup/dist/shared/node-entry.js:14128:20)
    at getOutputOptionsAndPluginDriver (node_modules/rollup/dist/shared/node-entry.js:13910:32)
    at Object.write (node_modules/rollup/dist/shared/node-entry.js:13983:63)
    at Object.build (node_modules/@pika/plugin-build-web/dist-node/index.js:61:16)
    at async node_modules/@pika/pack/dist-node/index.js:2375:11
    at async Build.init (node_modules/@pika/pack/dist-node/index.js:2459:7)
    at async Object.run (node_modules/@pika/pack/dist-node/index.js:2467:3)

This is related to the rollup write. Changing it to the following should solve it:

await result.write({
  dir: writeToWeb,
  format: 'esm',
  exports: 'named',
  sourcemap: options.sourcemap === undefined ? true : options.sourcemap,
});
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant