-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
__non_webpack_require__
incompatible with experiments.outputModule
+ devtool: 'eval-source-map'
#17971
Comments
Yeah, not sure how we can solve it, because we need |
I am unable to use Input:
Output:
As you can see, this still leads to |
I see... |
This issue had no activity for at least three months. It's subject to automatic issue closing if there is no activity in the next 15 days. |
bump |
Bug report
What is the current behavior?
When using
experiments.outputModule = true
in combination with__non_webpack_require__
anddevtool: 'eval-source-map'
(or any other of theeval
-based devtools), then you getError: Cannot use 'import.meta' outside a module
when trying to run the bundled file. This is becauseimport.meta
is accessed in the code that is passed as a string toeval
, which does not have access toimport.meta
.If the current behavior is a bug, please provide the steps to reproduce.
Full minimal sample project: https://stackblitz.com/edit/github-qjzdxl?file=webpack.config.cjs&view=editor
Run
npm install && npm run build && npm run start
to get the error.Important files:
package.json
which specifiestype: "module"
webpack.config.cjs
:src/index.js
:What is the expected behavior?
Webpack should use a different mechanism to access
import.meta
when using an eval-based devtool that avoids accessingimport.meta
inside of strings passed toeval
. Running the compiled file should printit worked
to the console.Other relevant information:
webpack version: 5.89.0
Node.js version: 18.18.0
Operating System: Linux
Additional tools: None
The text was updated successfully, but these errors were encountered: