bitque/jirs-client/webpack.config.js

56 lines
1.5 KiB
JavaScript
Raw Normal View History

2020-03-29 19:56:55 +02:00
const path = require("path");
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
2020-03-30 14:26:25 +02:00
const dotenv = require('dotenv');
const webpack = require('webpack');
dotenv.config();
2020-03-29 19:56:55 +02:00
module.exports = {
2020-03-30 14:26:25 +02:00
entry: path.resolve(__dirname, 'js', 'index.js'),
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dev'),
2020-03-29 19:56:55 +02:00
publicPath: '/',
},
2020-03-30 14:26:25 +02:00
devtool: 'source-map',
2020-03-29 19:56:55 +02:00
devServer: {
2020-03-30 14:26:25 +02:00
contentBase: path.join(__dirname, 'dev'),
2020-03-29 19:56:55 +02:00
historyApiFallback: true,
2020-03-30 14:26:25 +02:00
hot: true,
port: process.env.JIRS_CLIENT_PORT || 6000,
host: process.env.JIRS_CLIENT_BIND || '0.0.0.0',
allowedHosts: [
'localhost:6000',
2020-03-29 19:56:55 +02:00
'localhost:8000',
],
2020-03-30 14:26:25 +02:00
headers: {
2020-03-29 19:56:55 +02:00
'Access-Control-Allow-Origin': '*',
}
},
2020-03-30 14:26:25 +02:00
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
plugins: [
2020-03-29 19:56:55 +02:00
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname),
}),
2020-03-30 08:16:26 +02:00
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "js", "template.ejs"),
}),
2020-03-30 14:26:25 +02:00
new webpack.EnvironmentPlugin([
'NODE_ENV',
'DEBUG',
'JIRS_CLIENT_PORT',
'JIRS_CLIENT_BIND',
'JIRS_SERVER_PORT',
'JIRS_SERVER_BIND',
]),
2020-03-29 19:56:55 +02:00
]
};