mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-26 21:32:42 +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 { each } from 'lodash'
|
||||
import { resolve } from 'path'
|
||||
import { existsSync } from 'fs'
|
||||
import base from './base.config.js'
|
||||
|
||||
/*
|
||||
@ -34,15 +35,7 @@ export default function webpackServerConfig () {
|
||||
hints: false,
|
||||
maxAssetSize: Infinity
|
||||
},
|
||||
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
|
||||
})
|
||||
],
|
||||
externals: [],
|
||||
plugins: (config.plugins || []).concat([
|
||||
new VueSSRServerPlugin({
|
||||
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
|
||||
// --------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user