Skip to content

Instantly share code, notes, and snippets.

@aliceklipper
Last active November 30, 2019 16:16
Show Gist options
  • Save aliceklipper/bf26f721be80e0828f14463e98f6c53b to your computer and use it in GitHub Desktop.
Save aliceklipper/bf26f721be80e0828f14463e98f6c53b to your computer and use it in GitHub Desktop.
Simplest config for just TS building
const { join } = require('path');
const webpack = require('webpack');
const DefinePlugin = webpack.DefinePlugin;
module.exports = {
target : 'web',
entry : './src/index.tsx',
output : {
chunkFilename : '[id].index.js',
filename : 'index.js',
path : join(process.cwd(), 'build'),
publicPath : `/example/`,
},
devtool : 'source-map',
watch : true,
resolve : { extensions : ['.tsx', '.ts', '.js'] },
plugins : [new DefinePlugin({ 'process.env.NODE_ENV' : JSON.stringify(process.env.NODE_ENV || 'development') })],
module : {
rules : [
{
test : /\.tsx?$/,
exclude : /node_modules/,
use : [{ loader : 'ts-loader' }],
},
{
test : /\.json$/,
exclude : /node_modules/,
use : [{ loader : 'json-loader' }],
},
],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment