2017-01-17 13:40:59 +01:00
|
|
|
/**
|
|
|
|
* WEBPACK DLL GENERATOR
|
|
|
|
*
|
|
|
|
* This profile is used to cache webpack's module
|
|
|
|
* contexts for external library and framework type
|
|
|
|
* dependencies which will usually not change often enough
|
|
|
|
* to warrant building them from scratch every time we use
|
|
|
|
* the webpack process.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const { join } = require('path');
|
2017-05-11 14:17:21 +02:00
|
|
|
|
2017-01-17 13:40:59 +01:00
|
|
|
const defaults = require('lodash/defaultsDeep');
|
|
|
|
const webpack = require('webpack');
|
2017-05-11 14:17:21 +02:00
|
|
|
|
2017-01-17 13:40:59 +01:00
|
|
|
const dllPlugin = require('../config').dllPlugin;
|
2017-05-16 16:32:54 +02:00
|
|
|
const helperPkg = require(join(__dirname, '..', '..', '..', 'package.json'));
|
2017-01-17 13:40:59 +01:00
|
|
|
|
2017-05-16 16:32:54 +02:00
|
|
|
const pluginPkg = require(join(process.cwd(), 'package.json'));
|
2017-05-17 12:01:52 +02:00
|
|
|
if (!pluginPkg.dllPlugin) { pluginPkg.dllPlugin = {}; }
|
2017-05-16 16:32:54 +02:00
|
|
|
const dllConfig = defaults(pluginPkg.dllPlugin, dllPlugin.defaults);
|
2017-07-06 14:24:27 +02:00
|
|
|
const outputPath = dllConfig.path;
|
2017-01-17 13:40:59 +01:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
context: process.cwd(),
|
2017-05-16 16:32:54 +02:00
|
|
|
entry: dllPlugin.entry(helperPkg, pluginPkg),
|
2017-01-17 13:40:59 +01:00
|
|
|
devtool: 'eval',
|
|
|
|
output: {
|
|
|
|
filename: '[name].dll.js',
|
|
|
|
path: outputPath,
|
|
|
|
library: '[name]',
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.DllPlugin({ name: '[name]', path: join(outputPath, '[name].json') }), // eslint-disable-line no-new
|
|
|
|
],
|
2017-05-16 16:32:54 +02:00
|
|
|
resolve: {
|
|
|
|
modules: [
|
|
|
|
'node_modules',
|
2017-06-06 14:22:17 +02:00
|
|
|
'node_modules/strapi-helper-plugin/node_modules',
|
2017-05-16 16:32:54 +02:00
|
|
|
],
|
|
|
|
},
|
2017-01-17 13:40:59 +01:00
|
|
|
};
|