Skip to content

Instantly share code, notes, and snippets.

@alersenkevich
Created March 19, 2019 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alersenkevich/b3b62be8cdf3c7f24481b4783e9b55d4 to your computer and use it in GitHub Desktop.
Save alersenkevich/b3b62be8cdf3c7f24481b4783e9b55d4 to your computer and use it in GitHub Desktop.
react + typescript + webpack
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