Skip to content

Instantly share code, notes, and snippets.

@vemarav
Last active November 3, 2019 19:15
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 vemarav/b5b3f614efe6a17f1b1a975a66a390e5 to your computer and use it in GitHub Desktop.
Save vemarav/b5b3f614efe6a17f1b1a975a66a390e5 to your computer and use it in GitHub Desktop.
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const rootDir = path.join(__dirname, '..');
const webpackEnv = process.env.NODE_ENV || 'development';
module.exports = {
mode: webpackEnv,
entry: {
app: path.join(rootDir, './index.web.ts'),
},
output: {
path: path.resolve(rootDir, 'dist'),
filename: 'app-[hash].bundle.js',
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.(tsx|ts|jsx|js|mjs)$/,
exclude: /node_modules/,
loader: 'ts-loader',
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, './index.html'),
}),
new webpack.HotModuleReplacementPlugin(),
],
resolve: {
extensions: [
'.web.tsx',
'.web.ts',
'.tsx',
'.ts',
'.web.jsx',
'.web.js',
'.jsx',
'.js',
], // read files in fillowing order
alias: Object.assign({
'react-native$': 'react-native-web',
}),
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment