Skip to content

Commit

Permalink
fix dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerschloesser committed Feb 22, 2024
1 parent b55fc05 commit c08f08b
Showing 1 changed file with 39 additions and 29 deletions.
68 changes: 39 additions & 29 deletions packages/app/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,46 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
const { WebpackManifestPlugin } = require('webpack-manifest-plugin')

module.exports = {
entry: './index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'index.[contenthash].js',
publicPath: '/',
clean: true,
},
module: {
rules: [
{
test: /\.handlebars/,
loader: 'handlebars-loader',
},
],
},
plugins: [
new HtmlWebpackPlugin({
templateParameters: require('./index.json'),
template: 'index.handlebars',
filename: 'index.[contenthash].html',
}),
new CopyPlugin({
patterns: [
module.exports = (_env, argv) => {
const prod = argv.mode !== 'development'
const mode = prod ? 'production' : 'development'

return {
stats: 'minimal',
mode,
entry: './index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'index.[contenthash].js',
publicPath: '/',
clean: true,
},
module: {
rules: [
{
from: path.join(__dirname, 'public'),
to: path.join(__dirname, 'dist/public'),
test: /\.handlebars/,
loader: 'handlebars-loader',
},
],
}),
new WebpackManifestPlugin({}),
],
},
plugins: [
new HtmlWebpackPlugin({
templateParameters: require('./index.json'),
template: 'index.handlebars',
filename: prod ? 'index.[contenthash].html' : 'index.html',
}),
new CopyPlugin({
patterns: [
{
from: path.join(__dirname, 'public'),
to: path.join(__dirname, 'dist/public'),
},
],
}),
new WebpackManifestPlugin({}),
],
devServer: {
historyApiFallback: true,
},
}
}

0 comments on commit c08f08b

Please sign in to comment.