mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-04 19:37:18 +00:00
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
import webpack from 'webpack'
|
|
import { resolve } from 'path'
|
|
import ClientConfig from './client.config'
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Webpack Dll Config
|
|
| https://github.com/webpack/webpack/tree/master/examples/dll
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
export default function webpackDllConfig(_refConfig) {
|
|
const refConfig = _refConfig || new ClientConfig()
|
|
|
|
const name = refConfig.name + '-dll'
|
|
const dllDir = resolve(this.options.cacheDir, name)
|
|
|
|
let config = {
|
|
name,
|
|
entry: this.vendorEntries(),
|
|
// context: this.options.rootDir,
|
|
resolve: refConfig.resolve,
|
|
target: refConfig.target,
|
|
resolveLoader: refConfig.resolveLoader,
|
|
module: refConfig.module,
|
|
plugins: []
|
|
}
|
|
|
|
config.output = {
|
|
path: dllDir,
|
|
filename: '[name]_[hash].js',
|
|
library: '[name]_[hash]'
|
|
}
|
|
|
|
config.plugins.push(
|
|
new webpack.DllPlugin({
|
|
// The path to the manifest file which maps between
|
|
// modules included in a bundle and the internal IDs
|
|
// within that bundle
|
|
path: resolve(dllDir, '[name]-manifest.json'),
|
|
|
|
name: '[name]_[hash]'
|
|
})
|
|
)
|
|
|
|
return config
|
|
}
|