Skip to content

Commit 841fa0a

Browse files
committed
fix ASSET_PATH for webpack 5
1 parent 7cfbbb3 commit 841fa0a

File tree

5 files changed

+7
-2
lines changed

5 files changed

+7
-2
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chrome-extension-boilerplate-react",
3-
"version": "3.1.1",
3+
"version": "3.1.2",
44
"description": "A chrome extension boilerplate built with React 17 and Webpack 4",
55
"license": "MIT",
66
"repository": {

utils/build.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Do this as the first thing so that any code reading it knows the right env.
22
process.env.BABEL_ENV = 'production';
33
process.env.NODE_ENV = 'production';
4+
process.env.ASSET_PATH = '/';
45

56
var webpack = require('webpack'),
67
config = require('../webpack.config');

utils/webserver.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Do this as the first thing so that any code reading it knows the right env.
22
process.env.BABEL_ENV = 'development';
33
process.env.NODE_ENV = 'development';
4+
process.env.ASSET_PATH = '/';
45

56
var WebpackDevServer = require('webpack-dev-server'),
67
webpack = require('webpack'),

webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ var webpack = require('webpack'),
77
HtmlWebpackPlugin = require('html-webpack-plugin'),
88
TerserPlugin = require('terser-webpack-plugin');
99

10+
const ASSET_PATH = process.env.ASSET_PATH || '/';
11+
1012
var alias = {
1113
'react-dom': '@hot-loader/react-dom',
1214
};
@@ -46,6 +48,7 @@ var options = {
4648
output: {
4749
path: path.resolve(__dirname, 'build'),
4850
filename: '[name].bundle.js',
51+
publicPath: ASSET_PATH,
4952
},
5053
module: {
5154
rules: [

0 commit comments

Comments
 (0)