Skip to content

Instantly share code, notes, and snippets.

@errietta
Created July 2, 2018 21:17
Show Gist options
  • Save errietta/5ae9f33e2cd571295cc270be1e2b1409 to your computer and use it in GitHub Desktop.
Save errietta/5ae9f33e2cd571295cc270be1e2b1409 to your computer and use it in GitHub Desktop.
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "ie >= 11"]
},
"useBuiltIns": true
}]
]
}
let path = require('path');
module.exports = {
mode: "development",
entry: ['babel-polyfill', "./src/index.tsx"],
output: {
filename: "bundle.js",
path: __dirname + "/dist"
},
devServer: {
host: '0.0.0.0',
publicPath: '/public',
port: 8080,
historyApiFallback: {
index: 'index.html'
}
},
// Enable sourcemaps for debugging webpack's output.
devtool: "source-map",
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", ".json"],
modules: ['node_modules/'],
},
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{ test: /\.tsx?$/, loaders: ["babel-loader", "awesome-typescript-loader"] },
{
test: /\.js$/,
include: ['src', require.resolve('csv-parse')],
use: {
loader: 'babel-loader',
}
},
{
test: /\.css$/,
use: [
require.resolve('style-loader'),
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
modules: true,
localIdentName: '[name]__[local]__[hash:base64:5]'
}
}
],
include: [
/src/,
],
},
{
test: /\.css$/,
use: ['style-loader','css-loader'],
include: [
/node_modules/,
],
},
]
},
// When importing a module whose path matches one of the following, just
// assume a corresponding global variable exists and use that instead.
// This is important because it allows us to avoid bundling all of our
// dependencies, which allows browsers to cache those libraries between builds.
externals: {
"react": "React",
"react-dom": "ReactDOM"
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment