Skip to content
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

support for setting attributes #1697

Closed
electriquo opened this issue Oct 24, 2021 · 1 comment
Closed

support for setting attributes #1697

electriquo opened this issue Oct 24, 2021 · 1 comment

Comments

@electriquo
Copy link

electriquo commented Oct 24, 2021

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>

note that

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:

how can type="module" be added?
if the type="module" is not needed, how can i fix the issue?

@jantimon
Copy link
Owner

this has been added to the lastest version (5.5.0) thanks to @noppa #1672

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants