-
Notifications
You must be signed in to change notification settings - Fork 4.4k
In production build CSS Sourcemaps in codesplit chunks are "duplicated", contained in both the .map file and the .js file #1110
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
Comments
Thanks for posting this. I have a few questions:
I'll take as soon as I find some time to really dig into this. |
Okay, so I've taken a look. My observations
Possible short-term fixes:
The end goal:
..however, I have no idea if that's actually possible with the current webpack tools we have. Will investigate further. Webpack Experts' help welcomeThis seems to be a tricky one, so if someone out there has a good trick up their sleeve that they can share, please comment / send PR! |
@vuejs-templates/collaborators take a look if you can. |
In config/index.js look into
change this devtool value to configure bundle to whether to include sourcemaps or how to include them see the docs |
@CharlesKumar Yes, this option allows to select a sourcemap, and we can also disable it there. But as I said abov, disabling sourcemaps in production is not a real solution to the problem we are discussing, it's a quick workaround at best. |
Agree. We should split the sourcemap into isolation files, only leave the sourcemap file URL. That will save a lot bits. |
@LinusBorg Could extract-css-chunks-webpack-plugin provide a possible solution? |
@chrisvfritz not on its own. While it extracts css from code split chunks into individual css files (and with them possibly the sourcemaps), it leaves the chunk without runtime code to load that css. It seems to be meant in SSR scenarios specifically. I have hit up Sean on Twitter? hoping he has a pointer for us. |
setting productionGzip: true may solve the problem
a thread from old vue forum [[Just a tip to newbies who reading this comment]] |
Sorry, but that will only compress results, it won't remove the duplicated source maps |
Thanks for quick reaction to issues. By "duplicated" I meant that you can see it twice in the js file (for example in the screenshot) not that it's included in both js and css file. Sorry for not being clear enough. |
Well it's not really duplicated. One is the "real" css, one is the source css for the source map, so it's not really used as css during runtime. Still it doesn't belong there of course. |
After some discusssion with @chrisvfritz I think we should switch to Opinions? |
* `allChunks: true` by default close #1110 * update wording.
* develop: remove unnecessary exceptions bump version to 1.2.6 Add JX support (close #1146) Automatically install Dependencies and fix lint errors (#1133) Set `allChunks: true` by default (close #1110) (#1149) airbnb eslint config compatibility with vuex (#1003) Document babel target env configuration (#1144) Revert "remove uneccessary target.browsers (#1004)" (#1083) fix filename of `.eslintignore` (#1136) webpack.conf.js is not needed in jest and e2e (#1135) # Conflicts: # template/test/e2e/custom-assertions/elementCount.js
…templates#1149) * `allChunks: true` by default close vuejs-templates#1110 * update wording.
…templates#1149) * `allChunks: true` by default close vuejs-templates#1110 * update wording.
* develop: remove unnecessary exceptions bump version to 1.2.6 Add JX support (close vuejs-templates#1146) Automatically install Dependencies and fix lint errors (vuejs-templates#1133) Set `allChunks: true` by default (close vuejs-templates#1110) (vuejs-templates#1149) airbnb eslint config compatibility with vuex (vuejs-templates#1003) Document babel target env configuration (vuejs-templates#1144) Revert "remove uneccessary target.browsers (vuejs-templates#1004)" (vuejs-templates#1083) fix filename of `.eslintignore` (vuejs-templates#1136) webpack.conf.js is not needed in jest and e2e (vuejs-templates#1135) # Conflicts: # template/test/e2e/custom-assertions/elementCount.js
Just wondering if this issue is still present when setting allChunks to false. |
The fix for this issue is to create or edit your vue.config.js file With modules.export = { productionSourceMap : false } Npm run build and all that's the fix |
Steps to reproduce:
src/routes/index.js
:import HelloWorld from '@/components/HelloWorld'
component: HelloWorld
withcomponent: () => import('@/components/HelloWorld')
dist/static/js/0.[hash].js
The text was updated successfully, but these errors were encountered: