1+ const path = require ( 'path' ) ;
2+ const webpack = require ( 'webpack' ) ;
3+ const lintFormatter = require ( 'eslint-formatter-friendly' ) ;
4+ const UglifyJsPlugin = require ( 'uglifyjs-webpack-plugin' ) ;
5+
16module . exports = {
27 entry : './src/index.tsx' ,
38 output : {
@@ -10,6 +15,12 @@ module.exports = {
1015
1116 devtool : 'source-map' ,
1217
18+ stats : 'errors-only' ,
19+
20+ node : {
21+ fs : 'empty'
22+ } ,
23+
1324 resolve : {
1425 modules : [ path . resolve ( __dirname , './src' ) , 'node_modules' ] ,
1526 extensions : [ '.ts' , '.tsx' , '.js' , '.json' ]
@@ -29,10 +40,24 @@ module.exports = {
2940 failOnError : false
3041 }
3142 } ,
43+ {
44+ test : / \. ( e o t | s v g | t t f | w o f f | w o f f 2 ) $ / ,
45+ loader : 'file-loader?name=app/fonts/[name].[ext]'
46+ } ,
47+ {
48+ test : / \. ( p n g | j p g | g i f ) $ / ,
49+ use : [
50+ {
51+ loader : 'file-loader' ,
52+ options : { }
53+ }
54+ ]
55+ } ,
3256 { test : / \. t s x ? $ / , loader : 'awesome-typescript-loader' } ,
3357 { enforce : 'pre' , test : / \. j s $ / , loader : 'source-map-loader' }
3458 ]
3559 } ,
60+ plugins : [ new webpack . HotModuleReplacementPlugin ( ) , new webpack . NamedModulesPlugin ( ) , new UglifyJsPlugin ( ) ] ,
3661
3762 externals : {
3863 react : {
@@ -53,86 +78,3 @@ module.exports = {
5378 }
5479 }
5580} ;
56-
57- // const path = require('path');
58- // const webpack = require('webpack');
59- // const lintFormatter = require('eslint-formatter-friendly');
60- // const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
61-
62- // module.exports = {
63- // entry: './src/index.js',
64- // output: {
65- // filename: 'index.js',
66- // path: path.resolve(__dirname, 'dist'),
67- // publicPath: '/dist',
68- // library: '',
69- // libraryTarget: 'commonjs2'
70- // },
71- // resolve: {
72- // modules: [ path.resolve(__dirname, './src'), 'node_modules' ],
73- // extensions: [ '.js', '.jsx', '.json' ]
74- // },
75-
76- // externals: {
77- // react: {
78- // commonjs: 'react',
79- // commonjs2: 'react',
80- // amd: 'React',
81- // root: 'React'
82- // },
83- // 'react-dom': {
84- // commonjs: 'react-dom',
85- // commonjs2: 'react-dom',
86- // amd: 'ReactDOM',
87- // root: 'ReactDOM'
88- // },
89- // 'styled-components': {
90- // commonjs: 'styled-components',
91- // commonjs2: 'styled-components'
92- // }
93- // },
94-
95- // stats: 'errors-only',
96-
97- // node: {
98- // fs: 'empty'
99- // },
100-
101- // module: {
102- // rules: [
103- // {
104- // enforce: 'pre',
105- // test: /\.js?$/,
106- // loader: 'eslint-loader',
107- // exclude: /node_modules/,
108- // options: {
109- // configFile: './.eslintrc.json',
110- // formatter: lintFormatter,
111- // failOnWarning: false,
112- // failOnError: false
113- // }
114- // },
115- // {
116- // test: /\.(eot|svg|ttf|woff|woff2)$/,
117- // loader: 'file-loader?name=app/fonts/[name].[ext]'
118- // },
119- // {
120- // test: /\.js?$/,
121- // loader: 'babel-loader',
122- // exclude: /node_modules/
123- // },
124- // {
125- // test: /\.(png|jpg|gif)$/,
126- // use: [
127- // {
128- // loader: 'file-loader',
129- // options: {}
130- // }
131- // ]
132- // }
133- // ]
134- // },
135- // devtool: 'inline-source-map',
136-
137- // plugins: [ new webpack.HotModuleReplacementPlugin(), new webpack.NamedModulesPlugin(), new UglifyJsPlugin() ]
138- // };
0 commit comments