Skip to content

Commit

Permalink
Combined external and prod webpack config files
Browse files Browse the repository at this point in the history
  • Loading branch information
jpellizzari committed Nov 15, 2016
1 parent b11cfb0 commit c776f35
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 125 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ client/build-external/index.html:

endif

$(SCOPE_UI_BUILD_UPTODATE): client/Dockerfile client/package.json client/webpack.local.config.js client/webpack.production.config.js client/webpack.external.config.js client/server.js client/.eslintrc
$(SCOPE_UI_BUILD_UPTODATE): client/Dockerfile client/package.json client/webpack.local.config.js client/webpack.production.config.js client/server.js client/.eslintrc
$(SUDO) docker build -t $(SCOPE_UI_BUILD_IMAGE) client
touch $@

Expand Down
2 changes: 1 addition & 1 deletion client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ WORKDIR /home/weave
COPY package.json /home/weave/
ENV NPM_CONFIG_LOGLEVEL=warn NPM_CONFIG_PROGRESS=false
RUN npm install
COPY webpack.local.config.js webpack.production.config.js webpack.external.config.js server.js .babelrc .eslintrc .eslintignore /home/weave/
COPY webpack.local.config.js webpack.production.config.js server.js .babelrc .eslintrc .eslintignore /home/weave/
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
},
"scripts": {
"build": "webpack --config webpack.production.config.js",
"build-external": "webpack --config webpack.external.config.js",
"build-external": "EXTERNAL=true webpack --config webpack.production.config.js",
"start": "node server.js",
"start-production": "NODE_ENV=production node server.js",
"test": "jest",
Expand Down
121 changes: 0 additions & 121 deletions client/webpack.external.config.js

This file was deleted.

15 changes: 14 additions & 1 deletion client/webpack.production.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ const GLOBALS = {
'process.env': {NODE_ENV: '"production"'}
};

let OUTPUT_PATH = 'build/';
let PUBLIC_PATH = '/';

if (process.env.EXTERNAL) {
OUTPUT_PATH = 'build-external/';
// Change this line to point to resources on an external host.
PUBLIC_PATH = 'https://s3.amazonaws.com/static.weave.works/scope-ui/';
}

/**
* This is the Webpack configuration file for production.
*/
Expand All @@ -31,11 +40,15 @@ module.exports = {
},

output: {
path: path.join(__dirname, 'build/'),
path: path.join(__dirname, OUTPUT_PATH),
filename: '[name]-[chunkhash].js',
publicPath: PUBLIC_PATH
},

module: {
// Webpack is opionated about how pkgs should be laid out:
// https://github.com/webpack/webpack/issues/1617
noParse: /xterm/,
include: [
path.resolve(__dirname, 'app/scripts')
],
Expand Down

0 comments on commit c776f35

Please sign in to comment.