@@ -14,56 +14,36 @@ const {
1414
1515module . exports = ( env ) => {
1616
17- /*
18- * constants
19- * /
17+ //
18+ // constants
19+ / /
2020
2121 const BABEL_CONFIG = path . resolve ( __dirname , '../babel/babel.config.js' ) ;
2222 const BASE_PATH = `/${ env . basePath || 'edm' } /` ;
2323 const ENV_DEV = 'development' ;
2424 const ENV_PROD = 'production' ;
2525
26- // NOTE: for future reference
27- // const getNodeModulesRegEx = toInclude => (
28- // new RegExp(`/(node_modules|openlattice)/(${toInclude.join('|')})`)
29- // );
30-
31- /*
32- * loaders
33- */
26+ //
27+ // loaders
28+ //
3429
3530 const BABEL_LOADER = {
3631 test : / \. j s $ / ,
3732 exclude : / n o d e _ m o d u l e s / ,
3833 include : [
3934 APP_PATHS . ABS . SOURCE ,
40- // NOTE: for future reference
41- // getNodeModulesRegEx(['redux-reqseq']),
4235 ] ,
4336 use : {
4437 loader : 'babel-loader' ,
4538 options : {
46- cacheDirectory : true ,
4739 configFile : BABEL_CONFIG ,
4840 } ,
4941 } ,
5042 } ;
5143
52- const FILE_LOADER_ASSETS_IMAGES = {
53- test : / \. ( g i f | i c o | j p g | j p e g | p n g | s v g | w e b p ) ( \? .* ) ? $ / ,
54- exclude : / n o d e _ m o d u l e s / ,
55- use : [ {
56- loader : 'file-loader' ,
57- options : {
58- name : '[name].[hash:8].[ext]' ,
59- outputPath : `${ APP_PATHS . REL . STATIC_ASSETS_IMAGES } /` ,
60- }
61- } ]
62- } ;
63-
64- /*
65- * plugins
66- */
44+ //
45+ // plugins
46+ //
6747
6848 const BANNER_PLUGIN = new Webpack . BannerPlugin ( {
6949 banner : APP_CONFIG . BANNER ,
@@ -80,14 +60,9 @@ module.exports = (env) => {
8060 __VERSION__ : JSON . stringify ( `v${ PACKAGE . version } ` ) ,
8161 } ) ;
8262
83- // https://github.com/moment/moment/issues/2373
84- // https://stackoverflow.com/a/25426019/196921
85- // https://github.com/facebookincubator/create-react-app/pull/2187
86- const IGNORE_MOMENT_LOCALES = new Webpack . IgnorePlugin ( / ^ \. \/ l o c a l e $ / , / m o m e n t $ / ) ;
87-
88- /*
89- * base webpack config
90- */
63+ //
64+ // base webpack config
65+ //
9166
9267 return {
9368 bail : true ,
@@ -99,12 +74,19 @@ module.exports = (env) => {
9974 module : {
10075 rules : [
10176 BABEL_LOADER ,
102- FILE_LOADER_ASSETS_IMAGES ,
77+ {
78+ generator : {
79+ filename : (
80+ env . production
81+ ? `${ APP_PATHS . REL . STATIC_ASSETS } /[name].[contenthash].[ext]`
82+ : `${ APP_PATHS . REL . STATIC_ASSETS } /[name].[ext]`
83+ )
84+ } ,
85+ test : / \. ( g i f | i c o | j p g | j p e g | p n g | s v g | w e b p ) ( \? .* ) ? $ / ,
86+ type : 'asset/resource' ,
87+ } ,
10388 ] ,
10489 } ,
105- node : {
106- net : 'empty' ,
107- } ,
10890 optimization : {
10991 minimize : ! ! env . production ,
11092 } ,
@@ -118,7 +100,6 @@ module.exports = (env) => {
118100 plugins : [
119101 DEFINE_PLUGIN ,
120102 BANNER_PLUGIN ,
121- IGNORE_MOMENT_LOCALES ,
122103 ] ,
123104 resolve : {
124105 extensions : [ '.js' , '.css' ] ,
0 commit comments