-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Parcel 2 does not generate nomodule script #5945
Comments
This will unfortunately only be the case after #5398 is merged. Merging parcel-bundler/website#780 before that wasn't ideal cc @devongovett |
Will there be a fix? Or is there some workaround temporary option? |
Add both <script nomodule src="./index.tsx"></script>
<script type="module" src="./index.tsx"></script> |
Unfortunately, the proposed walkaround does not work. The Parcel 2 still does not create the required file. All it does is generate a layout with a link to the same javascript file. Poject tree MacBook-Pro-Andrey:parcel2 andrew$ tree -I node_modules
.
├── dist
│ ├── index.609f8ea4.css
│ ├── index.609f8ea4.css.map
│ ├── index.fd532818.js
│ ├── index.fd532818.js.map
│ └── index.html
├── index.js
├── index.pug
├── index.scss
├── package.json
└── yarn.lock
1 directory, 10 files index.pug doctype html
html(lang='en')
head
meta(charset='UTF-8')
meta(http-equiv='X-UA-Compatible' content='IE=edge')
meta(name='viewport' content='width=device-width, initial-scale=1.0')
title Document
link(rel='stylesheet' href='index.scss')
script(nomodule src='index.js')
script(type='module' src='index.js')
body
block frontdrop
#frontdrop.frontdrop(aria-hidden='false' role='alertdialog' aria-busy='true')
a(href='https://v2.parceljs.org/getting-started/webapp/#differential-serving' target='_blank' rel='noopener noreferrer')
img(src='https://v2.parceljs.org/assets/[email protected]' alt='Parcel 2 logo' height='60') In the screenshot below, the HTML DOM screenshot |
Is there any over walkaround? |
I'm currently having this issue too. Using Parcel My app has this, but nomodule script were not generated when running
I tried this:
Works fine if run with But when running
|
This is fixed in the latest nightly. |
🐛 bug report
Parcel 2 does not generate file and html code with
<script nomodule src="index.[hash].nomodule.js"></script>
as expected from differential-serving documentation🎛 Configuration (.babelrc, package.json, cli command)
package.json
Project serves with command
🤔 Expected Behavior
Since IE10 support is indicated and in the
package.json#browserslist
, which does not support ES6 using inindex.js
, it is expected that the Parcel 2 will automatically generate HTML with<script nomodule src="index.fd532818.nomodule.js"></script>
fileHTML DOM in browser inspector (Firefox)
Project tree
MacBook-Pro-andrey:parcel2 andrey$ tree -I node_modules . ├── dist │ ├── index.609f8ea4.css │ ├── index.609f8ea4.css.map │ ├── index.fd532818.js │ ├── index.fd532818.js.map │ ├── index.fd532818.nomodule.js │ ├── index.fd532818.nomodule.js.map │ └── index.html ├── index.js ├── index.pug ├── index.scss ├── package.json └── yarn.lock 1 directory, 12 files MacBook-Pro-andrey:parcel2 andrey$
😯 Current Behavior
HTML DOM in browser inspector (Firefox)
Project tree
MacBook-Pro-andrey:parcel2 andrey$ tree -I node_modules . ├── dist │ ├── index.609f8ea4.css │ ├── index.609f8ea4.css.map │ ├── index.fd532818.js │ ├── index.fd532818.js.map │ └── index.html ├── index.js ├── index.pug ├── index.scss ├── package.json └── yarn.lock 1 directory, 10 files MacBook-Pro-andrey:parcel2 andrey$
💁 Possible Solution
The solution indicated in differential-serving documentation is already looks suitable, but for some reason it does not work
🔦 Context
It is necessary to support old browsers such as IE10 in the project, on par with modern browsers, indicating them in one of the possible ways in a browserslist, so that Parcel 2 automatically determines whether it should to create a
<script nomodule src="index.[hash].nomodule.js"></script>
file and add it to html based on browserslist and the javascript code styles (ES[3/5/6/7/...])💻 Code Sample
index.pug
index.scss
index.js
🌍 Your Environment
The text was updated successfully, but these errors were encountered: