mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-27 13:52:38 +00:00
parent
92b6936811
commit
5aa4120c3d
@ -3,6 +3,7 @@ import VueSSRServerPlugin from 'vue-server-renderer/server-plugin'
|
|||||||
import nodeExternals from 'webpack-node-externals'
|
import nodeExternals from 'webpack-node-externals'
|
||||||
import { each } from 'lodash'
|
import { each } from 'lodash'
|
||||||
import { resolve } from 'path'
|
import { resolve } from 'path'
|
||||||
|
import { existsSync } from 'fs'
|
||||||
import base from './base.config.js'
|
import base from './base.config.js'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -34,15 +35,7 @@ export default function webpackServerConfig () {
|
|||||||
hints: false,
|
hints: false,
|
||||||
maxAssetSize: Infinity
|
maxAssetSize: Infinity
|
||||||
},
|
},
|
||||||
externals: [
|
externals: [],
|
||||||
// https://webpack.js.org/configuration/externals/#externals
|
|
||||||
// https://github.com/liady/webpack-node-externals
|
|
||||||
nodeExternals({
|
|
||||||
// load non-javascript files with extensions, presumably via loaders
|
|
||||||
whitelist: [/\.(?!(?:js|json)$).{1,5}$/i],
|
|
||||||
modulesDir: this.options.modulesDir
|
|
||||||
})
|
|
||||||
],
|
|
||||||
plugins: (config.plugins || []).concat([
|
plugins: (config.plugins || []).concat([
|
||||||
new VueSSRServerPlugin({
|
new VueSSRServerPlugin({
|
||||||
filename: 'server-bundle.json'
|
filename: 'server-bundle.json'
|
||||||
@ -56,6 +49,16 @@ export default function webpackServerConfig () {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// https://webpack.js.org/configuration/externals/#externals
|
||||||
|
// https://github.com/liady/webpack-node-externals
|
||||||
|
if (existsSync(this.options.modulesDir)) {
|
||||||
|
config.externals.push(nodeExternals({
|
||||||
|
// load non-javascript files with extensions, presumably via loaders
|
||||||
|
whitelist: [/\.(?!(?:js|json)$).{1,5}$/i],
|
||||||
|
modulesDir: this.options.modulesDir
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
// Production specific config
|
// Production specific config
|
||||||
// --------------------------------------
|
// --------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user