Skip to content

Commit b26ac6d

Browse files
authored
Merge pull request scratchfoundation#4646 from chrisgarrity/webconfig-static-path
Set static asset path (publicPath) with environment var
2 parents e5ba46f + e2a2dcf commit b26ac6d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

webpack.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var autoprefixer = require('autoprefixer');
1212
var postcssVars = require('postcss-simple-vars');
1313
var postcssImport = require('postcss-import');
1414

15+
const STATIC_PATH = process.env.STATIC_PATH || '/static';
16+
1517
const base = {
1618
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
1719
devtool: 'cheap-module-source-map',
@@ -195,7 +197,7 @@ module.exports = [
195197
output: {
196198
libraryTarget: 'umd',
197199
path: path.resolve('dist'),
198-
publicPath: '/static/'
200+
publicPath: `${STATIC_PATH}/`
199201
},
200202
externals: {
201203
React: 'react',
@@ -208,7 +210,7 @@ module.exports = [
208210
loader: 'file-loader',
209211
options: {
210212
outputPath: 'static/assets/',
211-
publicPath: '/static/assets/'
213+
publicPath: `${STATIC_PATH}/assets/`
212214
}
213215
}
214216
])

0 commit comments

Comments
 (0)