diff --git a/packages/webpack/src/plugins/vue/server.js b/packages/webpack/src/plugins/vue/server.js
index 00ac888029..b893b1dbc4 100644
--- a/packages/webpack/src/plugins/vue/server.js
+++ b/packages/webpack/src/plugins/vue/server.js
@@ -1,4 +1,4 @@
-import { validate, isJS } from './util'
+import { validate, isJS, extractQueryPartJS } from './util'
export default class VueSSRServerPlugin {
constructor(options = {}) {
@@ -44,7 +44,12 @@ export default class VueSSRServerPlugin {
stats.assets.forEach((asset) => {
if (isJS(asset.name)) {
- bundle.files[asset.name] = asset.name
+ const queryPart = extractQueryPartJS(asset.name)
+ if (queryPart !== undefined) {
+ bundle.files[asset.name] = asset.name.replace(queryPart, '')
+ } else {
+ bundle.files[asset.name] = asset.name
+ }
} else if (asset.name.match(/\.js\.map$/)) {
bundle.maps[asset.name.replace(/\.map$/, '')] = asset.name
} else {
diff --git a/packages/webpack/src/plugins/vue/util.js b/packages/webpack/src/plugins/vue/util.js
index 7db9feb8f8..1b992ff84d 100644
--- a/packages/webpack/src/plugins/vue/util.js
+++ b/packages/webpack/src/plugins/vue/util.js
@@ -22,6 +22,10 @@ export const validate = (compiler) => {
}
}
-export const isJS = file => /\.js(\?[^.]+)?$/.test(file)
+const isJSRegExp = /\.js(\?[^.]+)?$/
+
+export const isJS = file => isJSRegExp.test(file)
+
+export const extractQueryPartJS = file => isJSRegExp.exec(file)[1]
export const isCSS = file => /\.css(\?[^.]+)?$/.test(file)
diff --git a/test/fixtures/filenames-query-part/filenames-query-part.test.js b/test/fixtures/filenames-query-part/filenames-query-part.test.js
new file mode 100644
index 0000000000..d721c3eebc
--- /dev/null
+++ b/test/fixtures/filenames-query-part/filenames-query-part.test.js
@@ -0,0 +1,3 @@
+import { buildFixture } from '../../utils/build'
+
+buildFixture('filenames-query-part')
diff --git a/test/fixtures/filenames-query-part/nuxt.config.js b/test/fixtures/filenames-query-part/nuxt.config.js
new file mode 100644
index 0000000000..fb293c9e5a
--- /dev/null
+++ b/test/fixtures/filenames-query-part/nuxt.config.js
@@ -0,0 +1,8 @@
+export default {
+ build: {
+ filenames: {
+ app: '[name].js?v=[contenthash]',
+ chunk: '[name].js?v=[contenthash]'
+ }
+ }
+}
diff --git a/test/fixtures/filenames-query-part/pages/index.vue b/test/fixtures/filenames-query-part/pages/index.vue
new file mode 100644
index 0000000000..24fa9df56e
--- /dev/null
+++ b/test/fixtures/filenames-query-part/pages/index.vue
@@ -0,0 +1,5 @@
+
+ Chunks with version in query part
+