support for setting attributes
electriquo opened this issue · 1 comments
electriquo commented
i am using webpack 5 and when the web app is launched, the browser shows the following error
Uncaught SyntaxError: Cannot use 'import.meta' outside a module
currently, the output html has the following
<script defer src="vendors.0395f232202da9c00fd5.bundle.js"></script>
<script defer src="main.0395f232202da9c00fd5.bundle.js"></script>
and what fix the issue is having type="module"
<script defer src="vendors.0395f232202da9c00fd5.bundle.js"></script>
<script defer src="main.0395f232202da9c00fd5.bundle.js" type="module"></script>
There is no need to use the defer attribute (see <script> attributes) when loading a module script; modules are deferred automatically.
i used to leverage https://github.com/numical/script-ext-html-webpack-plugin to handle it
new ScriptExtHtmlWebpackPlugin({
module: "main",
}),
but https://github.com/numical/script-ext-html-webpack-plugin has been deprecated and has no support for webpack 5. also tried setting the value "module"
for the following configurations without any success:
- https://webpack.js.org/configuration/output/#outputscripttype
- https://webpack.js.org/configuration/output/#outputlibrarytype
- https://webpack.js.org/configuration/output/#outputmodule
- https://webpack.js.org/configuration/output/#librarytarget-module
how can type="module"
be added?
if the type="module"
is not needed, how can i fix the issue?