-
-
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
production minify code doesn't work well(npm run build), but development is ok(npm start) #1887
Comments
Perhaps something I noticed just yesterday may be of some help. Importing Fontawesome's SVG icons, even individually — e.g. |
@BenSapiens But you don't have any errors, otherwise this is a treeshaking issue and probably unrelated to this issue? |
@DeMoorJasper You're right. I missed the bit about the page not rendering normally. My apologies. |
I found this bug cause vue component data not render normally in production, but development is ok. |
Without a complete standalone test case to reproduce the problem, this issue may as well be closed. |
It's up to u |
I came here looking for this. I have a Vuejs project that works under dev conditions but not after a build. I had a hunch it might be to do with minification, so I changed my npm build script from:
to
And now the "build" version works. My project: https://github.com/freemagee/sugar-cubed/tree/parcel I am sorry that my project is also not a complete standalone test case as I use an API key, which is not included in the project. I will try to host a working and non working version of the app if that may help. |
@freemagee yes, agree with u, "build-hack": "cross-env NODE_ENV=production rimraf dist/production & parcel build src/index.js -d dist/production/ --no-minify --no-source-maps --detailed-report", but i found other problem, the code after build has module.exports = str => encodeURIComponent(str).replace(/[!'()*]/g, x => '%' + x.charCodeAt(0).toString(16).toUpperCase()); this code from the dependency of query-string, but it didn't build by parcel(browserslist include ie10)? |
I had not seen it until now, but this issue has been referenced before: I think I am going to follow your advice and use another step for the minification. Probably look at I am sorry, I do not know the solution to your |
The arrow function should have been extracted out, babel-preset-env runs over every module. About the minifications if you could create some kind of reproduction the parcel or terser team can have a look at it depending on whether it's a parcel bug or not (Preferably not an entire project with dozens of files) |
I have a similar issue, my external css files (from other packages) are not being included in prod build. Let me create a demo repo to bring the issue to light because --no-minify is not working for me. |
If no-minify isn't working this is an unrelated issue, please create a new issue. @amankapoor |
@DeMoorJasper Done. Issue is at #1910 :) |
I have hosted two builds. Standard looks ok initially, but does not work. --no-minify works. Hope this helps a bit. Just to be clear this is a Vue.js project that uses single file vue components. Standard build --no-minify flag |
I also encountered a similar problem, I found a solution: change all |
We can use: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md But that will only hide the real issue... |
I have another example project. When I build https://github.com/uwdata/falcon with
The app starts but when I try to draw a brush in one chart (click and drag), the others are empty. But when I build with
the other charts update correctly. Is this part of this issue or should I file a separate issue? |
I have the exact same problem and the only solution I have found is to use https://github.com/ljharb/qs instead of To reproduce, just create a project with a dependency on You will end up with this code in your app.js:
As already state by @ccjoe |
Got it, it's probably a mismatch between babel and terser, as terser doesn't look at babelrc or browserslist unfortunately. Might just be as easy as changing the terser config inside parcel to target an older js version |
@RPDeshaies query-string readme.md has mentioned
so qs or query-string@5 |
oh nice catch @ccjoe
|
@RPDeshaies you could debug it and try it, it should not be hard at all. But no need to open a seperate issue, unless you want me to close this one. I'll just try to get this fixed and open a PR real quick myself it's only a couple minutes work |
I'm very confused with this. Is this off-topic or is the title just completely wrong as both dev and production give an arrow function as far as I've experimented with it. |
@DeMoorJasper I have the impression that @ccjoe 's title might be wrong or it's something else because @ccjoe stated
So it might be two unrelated issues ? |
Found the bug, it uses node as a fallback and if the module has no known target it just doesn't get compiled/transformed. Seems pretty strange to me, opened a PR to fix this, see #2073 Please have a look at the PR, I'll try get the tests to work, but they pretty much emulate something that could happen in the real world, although probably a really bad thing. (Having experimental JS features in node_modules) |
I'm sorry, minification and |
Alright so I'm gonna close this issue as it became a mess of 2 or more different issues and an issue shouldn't contain multiple issues as that makes tracking progress pretty hard and one of the issues got resolved. About the arrow function issue, apparently by design Parcel does not transform any package that doesn't contain an engines or browserslist. And the package mentioned in this issue, does not have an accurate browserslist, so it leaves the code as is. |
npm scripts pls read package.json below
🐛 bug report
🎛 Configuration (.babelrc, package.json, cli command)
babelrc
package.json
🤔 Expected Behavior
production minify code work normally。(if i minify development code by other minify tool, work well too )
😯 Current Behavior
production minify code doesn't work well, and have no error in console(page can't render normal, it's blank); development code work well, ,
💁 Possible Solution
production minify bug?
🌍 Your Environment
parcel with vue project
The text was updated successfully, but these errors were encountered: