11/* eslint-disable @typescript-eslint/no-var-requires */
22
3- const path = require ( 'path' ) ;
4- const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
5- const CopyPlugin = require ( 'copy-webpack-plugin' ) ;
6- const TsconfigPathsPlugin = require ( 'tsconfig-paths-webpack-plugin' ) ;
7- const Dotenv = require ( 'dotenv-webpack' ) ;
3+ import path from 'path' ;
4+ import HtmlWebpackPlugin from 'html-webpack-plugin' ;
5+ import CopyPlugin from 'copy-webpack-plugin' ;
6+ import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin' ;
7+ import Dotenv from 'dotenv-webpack' ;
88const BG_IMAGES_DIRNAME = 'bgimages' ;
99const ASSET_PATH = process . env . ASSET_PATH || '/' ;
10- module . exports = ( env ) => {
10+
11+ export default ( env ) => {
1112 return {
1213 module : {
1314 rules : [
@@ -29,11 +30,11 @@ module.exports = (env) => {
2930 // only process modules with this loader
3031 // if they live under a 'fonts' or 'pficon' directory
3132 include : [
32- path . resolve ( __dirname , ' node_modules/patternfly/dist/fonts') ,
33- path . resolve ( __dirname , ' node_modules/@patternfly/react-core/dist/styles/assets/fonts') ,
34- path . resolve ( __dirname , ' node_modules/@patternfly/react-core/dist/styles/assets/pficon') ,
35- path . resolve ( __dirname , ' node_modules/@patternfly/patternfly/assets/fonts') ,
36- path . resolve ( __dirname , ' node_modules/@patternfly/patternfly/assets/pficon') ,
33+ path . resolve ( './ node_modules/patternfly/dist/fonts') ,
34+ path . resolve ( './ node_modules/@patternfly/react-core/dist/styles/assets/fonts') ,
35+ path . resolve ( './ node_modules/@patternfly/react-core/dist/styles/assets/pficon') ,
36+ path . resolve ( './ node_modules/@patternfly/patternfly/assets/fonts') ,
37+ path . resolve ( './ node_modules/@patternfly/patternfly/assets/pficon') ,
3738 ] ,
3839 } ,
3940 {
@@ -74,23 +75,14 @@ module.exports = (env) => {
7475 {
7576 test : / \. ( j p g | j p e g | p n g | g i f ) $ / i,
7677 include : [
77- path . resolve ( __dirname , 'src' ) ,
78- path . resolve ( __dirname , 'node_modules/patternfly' ) ,
79- path . resolve ( __dirname , 'node_modules/@patternfly/patternfly/assets/images' ) ,
80- path . resolve ( __dirname , 'node_modules/@patternfly/react-styles/css/assets/images' ) ,
81- path . resolve ( __dirname , 'node_modules/@patternfly/react-core/dist/styles/assets/images' ) ,
82- path . resolve (
83- __dirname ,
84- 'node_modules/@patternfly/react-core/node_modules/@patternfly/react-styles/css/assets/images'
85- ) ,
86- path . resolve (
87- __dirname ,
88- 'node_modules/@patternfly/react-table/node_modules/@patternfly/react-styles/css/assets/images'
89- ) ,
90- path . resolve (
91- __dirname ,
92- 'node_modules/@patternfly/react-inline-edit-extension/node_modules/@patternfly/react-styles/css/assets/images'
93- ) ,
78+ path . resolve ( './src' ) ,
79+ path . resolve ( './node_modules/patternfly' ) ,
80+ path . resolve ( './node_modules/@patternfly/patternfly/assets/images' ) ,
81+ path . resolve ( './node_modules/@patternfly/react-styles/css/assets/images' ) ,
82+ path . resolve ( './node_modules/@patternfly/react-core/dist/styles/assets/images' ) ,
83+ path . resolve ( './node_modules/@patternfly/react-core/node_modules/@patternfly/react-styles/css/assets/images' ) ,
84+ path . resolve ( './node_modules/@patternfly/react-table/node_modules/@patternfly/react-styles/css/assets/images' ) ,
85+ path . resolve ( './node_modules/@patternfly/react-inline-edit-extension/node_modules/@patternfly/react-styles/css/assets/images' )
9486 ] ,
9587 type : 'asset/inline' ,
9688 use : [
@@ -107,12 +99,12 @@ module.exports = (env) => {
10799 } ,
108100 output : {
109101 filename : '[name].bundle.js' ,
110- path : path . resolve ( __dirname , ' dist') ,
102+ path : path . resolve ( './ dist') ,
111103 publicPath : ASSET_PATH ,
112104 } ,
113105 plugins : [
114106 new HtmlWebpackPlugin ( {
115- template : path . resolve ( __dirname , ' src', 'index.html' ) ,
107+ template : path . resolve ( './ src', 'index.html' ) ,
116108 } ) ,
117109 new Dotenv ( {
118110 systemvars : true ,
@@ -126,7 +118,7 @@ module.exports = (env) => {
126118 extensions : [ '.js' , '.ts' , '.tsx' , '.jsx' ] ,
127119 plugins : [
128120 new TsconfigPathsPlugin ( {
129- configFile : path . resolve ( __dirname , './tsconfig.json' ) ,
121+ configFile : path . resolve ( './tsconfig.json' ) ,
130122 } ) ,
131123 ] ,
132124 symlinks : false ,
0 commit comments