We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
System: OS: Linux 5.10 Ubuntu 20.04 LTS (Focal Fossa) CPU: (12) x64 Intel(R) Core(TM) i7-10810U CPU @ 1.10GHz Memory: 1.63 GB / 15.51 GB Container: Yes Shell: 5.0.17 - /bin/bash Binaries: Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node Yarn: 1.22.15 - ~/.nvm/versions/node/v16.13.0/bin/yarn npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm npmPackages: @rspack/cli: 0.1.1 => 0.1.1
The output.library.target = 'module' does not output ESM modules, support for this is mentioned in the documentation: https://www.rspack.dev/config/output.html#outputlibrarytype In Webpack this worked when an experiment was enabled: https://webpack.js.org/configuration/output/#module-definition-systems
output.library.target = 'module'
# ./rspack.config.js const path = require('path'); module.exports = { entry: { add: './src/add.js', }, target: 'es2020', output: { filename: '[name].bundle.mjs', path: path.resolve(__dirname, 'dist'), library: { type: 'module', }, }, };
# ./src/add.js export const add = (a, b) => a + b
This gives output of
# ./dist/add.bundle.mjs !function(){var e={380:function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"add",{enumerable:!0,get:function(){return n}});let n=(e,r)=>e+r}},r={};!function t(n){var o=r[n];if(void 0!==o)return o.exports;var u=r[n]={exports:{}};return e[n](u,u.exports,t),u.exports}("380")}(); //# sourceMappingURL=add.bundle.mjs.map
I would expect it to output something along the lines of the original source using export
# expected const add = (a, b) => a + b export { add }
https://github.com/thebreiflabb/rspack-es-module-error-repro
pnpm install pnpm build pnpm test
The test fails because the outputted dist/add.bundle.mjs does not export { add }
export { add }
The text was updated successfully, but these errors were encountered:
sorry we are not supportting esm output yet
Sorry, something went wrong.
When is esm output supported? We need esm and system. What can be done to support this?
esm
system
This will be easier to land after webpack/webpack#17121 and by extension webpack/webpack#2933 lands in webpack.
esm output is supported, please check it in @0.1.19 version
Awesome, it works with the new version when enabling experiments.outputModule = true, thank you!
experiments.outputModule = true
No branches or pull requests
System Info
System:
OS: Linux 5.10 Ubuntu 20.04 LTS (Focal Fossa)
CPU: (12) x64 Intel(R) Core(TM) i7-10810U CPU @ 1.10GHz
Memory: 1.63 GB / 15.51 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.15 - ~/.nvm/versions/node/v16.13.0/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
npmPackages:
@rspack/cli: 0.1.1 => 0.1.1
Details
The
output.library.target = 'module'
does not output ESM modules, support for this is mentioned in the documentation: https://www.rspack.dev/config/output.html#outputlibrarytypeIn Webpack this worked when an experiment was enabled: https://webpack.js.org/configuration/output/#module-definition-systems
This gives output of
I would expect it to output something along the lines of the original source using export
Reproduce link
https://github.com/thebreiflabb/rspack-es-module-error-repro
Reproduce Steps
pnpm install pnpm build pnpm test
The test fails because the outputted dist/add.bundle.mjs does not
export { add }
The text was updated successfully, but these errors were encountered: