From 975b1f4f669c2685dba315de7254e6e2502a200f Mon Sep 17 00:00:00 2001 From: Paul Graffam Date: Mon, 5 Apr 2021 11:41:56 -0400 Subject: [PATCH] Set public path to work in dev and prod --- src/public/index.html | 2 +- webpack.config.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/public/index.html b/src/public/index.html index c4eaf2d..9e4babd 100644 --- a/src/public/index.html +++ b/src/public/index.html @@ -3,7 +3,7 @@ Three.js Webpack ES6 Boilerplate - +
diff --git a/webpack.config.js b/webpack.config.js index d2709fa..2623f66 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -12,6 +12,7 @@ const includePath = path.join(__dirname, 'src/js'); const nodeModulesPath = path.join(__dirname, 'node_modules'); let outputPath = path.join(__dirname, 'src/public/js'); +let publicPath = '/js/'; module.exports = env => { // Dev environment @@ -30,6 +31,7 @@ module.exports = env => { mode = 'production'; stats = 'none'; outputPath = `${__dirname}/build/js`; + publicPath = 'js/'; } console.log('Webpack build -'); @@ -51,8 +53,7 @@ module.exports = env => { // must be an absolute path (use the Node.js path module) path: outputPath, // the url to the output directory resolved relative to the HTML page - // should include at least trailing slash - publicPath: '/js/', + publicPath, // the filename template for entry chunks filename: '[name].bundle.js', chunkFilename: '[name].bundle.js',