2020-05-04 08:15:09 -05:00

30 lines
970 B
JavaScript

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = (env) => {
const production = env === 'production' || process.env.NODE_ENV === 'production';
return {
mode: production ? 'production' : 'development',
devtool: production ? 'source-maps' : 'inline-source-map',
entry: './src/main.ts',
resolve: {
extensions: ['.ts', '.js'],
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
},
devServer: {
historyApiFallback: true,
open: !process.env.CI,
port: 9000,
lazy: false,
},
module: {
rules: [
{ test: /\.css$/i, use: ['style-loader', 'css-loader'] },
{ test: /\.ts$/i, use: ['ts-loader', '@aurelia/webpack-loader'], exclude: /node_modules/ },
{ test: /\.html$/i, use: '@aurelia/webpack-loader', exclude: /node_modules/ },
],
},
plugins: [new HtmlWebpackPlugin({ template: 'index.ejs' })],
};
};