bitque/react-client/webpack.config.js

63 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-03-28 21:41:16 +01:00
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
context: __dirname,
entry: path.join(__dirname, 'src/index.jsx'),
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dev'),
publicPath: '/',
},
module: {
rules: [
{
2020-03-29 19:56:55 +02:00
test: /\.([tj])sx?$/,
2020-03-28 21:41:16 +01:00
exclude: /node_modules/,
2020-03-29 19:56:55 +02:00
use: [ 'swc-loader' ],
2020-03-28 21:41:16 +01:00
},
{
test: /\.css$/,
use: ['style-loader', { loader: 'css-loader' }],
},
{
test: /\.(jpe?g|png|gif|woff2?|eot|ttf|otf|svg)$/,
use: [
{
loader: 'url-loader',
options: { limit: 15000 },
},
],
},
],
},
resolve: {
2020-03-29 19:56:55 +02:00
modules: [ path.join(__dirname, 'src'), 'node_modules' ],
extensions: [ '*', '.js', '.jsx', '.ts', '.tsx' ],
2020-03-28 21:41:16 +01:00
},
2020-03-29 19:56:55 +02:00
devtool: 'source-map',
2020-03-28 21:41:16 +01:00
devServer: {
contentBase: path.join(__dirname, 'dev'),
historyApiFallback: true,
hot: true,
port: 8000,
host: '0.0.0.0',
2020-03-29 19:56:55 +02:00
allowedHosts: [
'localhost:3000',
'localhost:8000',
],
headers: {
'Access-Control-Allow-Origin': '*',
}
2020-03-28 21:41:16 +01:00
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'src/index.html'),
favicon: path.join(__dirname, 'src/favicon.png'),
}),
],
};