Last active
November 3, 2019 19:15
-
-
Save vemarav/b5b3f614efe6a17f1b1a975a66a390e5 to your computer and use it in GitHub Desktop.
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 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