webpack5 and loaders defined as `.mjs`: enable use of `someloader.mjs` ?
See original GitHub issueFeature request
What is the expected behavior?
- creating a loader as
someloader.cjs
orsomeloader.js
works perflectly - creating the same loader as
someloader.mjs
throws error (see below
What is motivation or use case for adding/changing the behavior?
- i (and others imo) want to define loaders as mjs
How should this be implemented in your opinion?
- i would need to review webpack internals (and docs, as i could be wrong and theres a bug in my code) before providing an opinion
Are you willing to work on this yourself? yes (with proper support on webpack internals)
example repository where i tried to load someloader.mjs
- clone repo
$ cd packages/libraries/configproto/webpack
$ pnpm install
$ node removeFlowTypesLoader.test.mjs
- see error in terminal
more information
- someloader.cjs that works fine in tap tests
- someloader.cjs converted to .mjs that throws error in tap test
- my copypasta test.compiler.mjs from webpack docs
- line in test file with testconfig for someloader.cjs
- line in test file with testconfig for someloader.mjs
- line in test file for testing bundling with someloader.mjs
- link to issue created in node-tap
- possible related issue https://github.com/webpack/webpack/issues/4072
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Webpack 5 release (2020-10-10)
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >Loaders - webpack
Loaders are transformations that are applied to the source code of a module. They allow you to pre-process files as you import or...
Read more >Module | webpack - JS.ORG
Applied loaders: An array of loaders applied to the resource. Parser options: An options object which should be used to create the parser...
Read more >Module Methods - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >ECMAScript Modules - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please update webpack to the latest version too
Something wrong with tap