Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings
webpack

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Webpack v5.99.9 production build failing to load a Vue 2 application#19969

Unanswered
woahitsjc asked this question inQ&A
Discussion options

Upgrading webpack to v5.99.9 or above causes the production build to fail at runtime:

image

Packages:
webpack: 5.102.0
vue: 2.7.16
typescript: 5.8.3
mini-css-extract-plugin: 2.9.4 (relevant to production config)
vuex: 3.6.2

Webpack configuration differences between development and production:

{    ...rest,devtool:mode==="production" ?undefined :"eval-source-map",plugins:[newwebpack.DefinePlugin({// This is used for VueXPRODUCTION:JSON.stringify(mode==="production")}),newMiniCssExtractPlugin({filename:mode==="production" ?"[name].[contenthash].bundle.css" :"[name].dev.bundle.css",})],output:{publicPath:"",path:path.join(__dirname,<path-to-wwwroot-folder>),filename:mode==="production" ?"[name].[contenthash].bundle.js" :"[name].dev.bundle.js",devtoolModuleFilenameTemplate:info=>{let$filename="sources://"+info.resourcePath;if(info.resourcePath.match(/\.vue$/)&&!info.query.match(/type=script/)){$filename="webpack-generated:///"+info.resourcePath+"?"+info.hash;}return$filename;},devtoolFallbackModuleFilenameTemplate:"webpack:///[resource-path]?[hash]"},resolve:{alias:{"vue":mode==="production" ?"vue/dist/vue.min.js" :"vue/dist/vue.js","@common":path.resolve(__dirname,"./src/common/"),"@css":path.resolve(__dirname,"./styles"),},extensions:[".ts",".tsx",".js",".vue"]},}
You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

Unfortunately there is not enough information to help you, try to make a reproducible repository. Does this only happen in production? Can you try to disable minimizer (setoptimizations.minimize: false) and look at result?

You must be logged in to vote
2 replies
@Jameskmonger
Comment options

Hi@alexander-akait thanks for your response.

We're not able to create a reproducible repository at the moment, it doesn't seem to occur in a more simple setup.

I have identified that the issue seems to relate to theusedExports flag. As@woahitsjc mentioned, this occurs in5.99.9 onwards and only when building withproduction mode.

Without specifying a value forusedExports, a number of exports from a number of modules are removed, causing runtime breakages. With the flag set tofalse explicitly the build now succeeds in5.99.9.

@alexander-akait
Comment options

@Jameskmonger Thanks for details, looks like a bug/regression, did you try the latest version 5.102.0? Also can you try to disableoptimizations.minimize: false to see the code where it happens, it may help to identify the problem place/pattern, without real code hard to say where and why it happens, we have a a lot of tests for used exports, anyway looks like we didn't cover your case, waiting feedback

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
3 participants
@woahitsjc@Jameskmonger@alexander-akait

[8]ページ先頭

©2009-2025 Movatter.jp