2017-01-17 13:40:59 +01:00
/ * *
* WEBPACK DLL GENERATOR
*
2018-10-04 15:22:10 -05:00
* 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 .
2017-01-17 13:40:59 +01:00
* /
2017-09-27 15:09:46 +02:00
const path = require ( 'path' ) ;
2017-01-17 13:40:59 +01:00
const webpack = require ( 'webpack' ) ;
2017-11-17 16:05:47 +01:00
const isAdmin = process . env . IS _ADMIN === 'true' ;
2018-05-03 17:39:24 +02:00
// const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
const isSetup = process . env . IS _MONOREPO ;
2018-10-04 15:22:10 -05:00
const appPath = process . env . APP _PATH || path . resolve ( process . env . PWD , '..' , ( isAdmin ? '' : '..' ) ) ;
2017-05-11 14:17:21 +02:00
2018-01-19 14:50:34 +01:00
const rootAdminpath = ( ( ) => {
if ( isSetup ) {
return isAdmin ? path . resolve ( appPath , 'strapi-admin' ) : path . resolve ( appPath , 'packages' , 'strapi-admin' ) ;
}
return path . resolve ( appPath , 'admin' ) ;
} ) ( ) ;
2017-01-17 13:40:59 +01:00
module . exports = {
2017-11-17 16:18:23 +01:00
context : appPath ,
2017-09-27 15:09:46 +02:00
entry : {
2018-03-08 12:56:44 +01:00
vendor : [ 'react' , 'react-dom' , 'react-intl' , 'reactstrap' , 'react-transition-group' , 'immutable' , 'lodash' , 'babel-polyfill' ] , // Shared dependencies accross the admin and plugins.
2017-09-27 15:09:46 +02:00
} ,
devtool : 'cheap-module-source-map' ,
2017-01-17 13:40:59 +01:00
output : {
filename : '[name].dll.js' ,
2018-01-19 14:50:34 +01:00
path : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'lib' , 'internals' , 'webpack' , 'dist' ) ,
2017-09-27 15:09:46 +02:00
// The name of the global variable which the library's
// require() function will be assigned to
library : '[name]_lib' ,
2017-01-17 13:40:59 +01:00
} ,
plugins : [
2017-09-27 15:09:46 +02:00
new webpack . DllPlugin ( {
name : '[name]_lib' ,
2018-01-19 14:50:34 +01:00
path : path . resolve ( rootAdminpath , 'admin' , 'src' , 'config' , 'manifest.json' ) ,
2018-03-08 12:56:44 +01:00
} ) ,
2017-01-17 13:40:59 +01:00
] ,
2017-05-16 16:32:54 +02:00
resolve : {
modules : [
2017-09-27 15:09:46 +02:00
'admin/src' ,
'node_modules/strapi-helper-plugin/lib/src' ,
2017-06-06 14:22:17 +02:00
'node_modules/strapi-helper-plugin/node_modules' ,
2017-09-27 15:09:46 +02:00
'node_modules' ,
] ,
alias : {
moment : 'moment/moment.js' ,
2018-01-19 15:58:29 +01:00
'babel-polyfill' : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'node_modules' , 'babel-polyfill' ) ,
2018-01-19 14:50:34 +01:00
'lodash' : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'node_modules' , 'lodash' ) ,
'immutable' : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'node_modules' , 'immutable' ) ,
'react-intl' : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'node_modules' , 'react-intl' ) ,
'react' : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'node_modules' , 'react' ) ,
'react-dom' : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'node_modules' , 'react-dom' ) ,
'react-transition-group' : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'node_modules' , 'react-transition-group' ) ,
2018-03-08 12:56:44 +01:00
'reactstrap' : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'node_modules' , 'reactstrap' ) ,
2018-08-09 13:36:25 +02:00
'react-dnd' : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'node_modules' , 'react-dnd' ) ,
'react-dnd-hmtl5-backend' : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'node_modules' , 'react-dnd-html5-backend' ) ,
2018-09-07 17:29:33 +02:00
'styled-components' : path . resolve ( rootAdminpath , 'node_modules' , 'strapi-helper-plugin' , 'node_modules' , 'styled-components' ) ,
2017-09-27 15:09:46 +02:00
} ,
symlinks : false ,
extensions : [
'.js' ,
'.jsx' ,
'.react.js' ,
] ,
mainFields : [
'browser' ,
'jsnext:main' ,
'main' ,
2017-05-16 16:32:54 +02:00
] ,
} ,
2017-01-17 13:40:59 +01:00
} ;