-
-
Save alersenkevich/b3b62be8cdf3c7f24481b4783e9b55d4 to your computer and use it in GitHub Desktop.
react + typescript + webpack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const webpack = require('webpack'); | |
const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); | |
module.exports = { | |
entry: "./src/index.tsx", | |
output: { | |
path: path.resolve(__dirname, '../public'), | |
filename: "bundle.js", | |
}, | |
devtool: "source-map", | |
resolve: { | |
modules: ['node_modules', path.resolve('app')], | |
extensions: ['.js', '.jsx', '.json'], | |
}, | |
/* --was-- resolve: { | |
extensions: [".ts", ".tsx", ".js", ".json"] | |
},*/ | |
module: { | |
rules: [ | |
{ test: /\.tsx?$/, loader: "ts-loader" }, | |
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" } | |
] | |
}, | |
optimization: { | |
minimizer: [ | |
new UglifyJsPlugin({ | |
cache: true, | |
parallel: true, | |
uglifyOptions: { | |
compress: false, | |
ecma: 6, | |
mangle: true | |
}, | |
sourceMap: true | |
}) | |
] | |
}, | |
devServer: { | |
contentBase: path.join(__dirname, '../public'), | |
historyApiFallback: true, | |
compress: true, | |
hot: true, | |
port: 9000, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment