diff --git a/.gitignore b/.gitignore index d196a5b21476353e0a6c5654b3e8afc74e2ceab3..1117a083f16ad10b5fd71c6ee5a299e9bccb9e77 100644 --- a/.gitignore +++ b/.gitignore @@ -57,8 +57,8 @@ typings/ # dotenv environment variables file .env -# Ignore public folder with webpack build output -public/ +# Ignore dist folder with webpack build output +dist/ .DS_Store diff --git a/package.json b/package.json index f11c58103a59ddca20d65e701beaded9dc6d346b..cd9a0e6c0f963d4d931164f8121fc42fb2609269 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "scripts": { "postinstall": "node ./scripts/postinstall.js", "start": "webpack-dev-server --mode=development", - "build": "rimraf ./public && webpack --mode=production", + "build": "rimraf ./dist && webpack --mode=production", "doc": "node ./scripts/doc/build.js", "prettier": "prettier --write '*.js' 'src/**/*.js'", "lint:js": "eslint '*.js' 'scripts/**/*.js' 'src/**/*.js'", diff --git a/scripts/hab-build-and-push.sh b/scripts/hab-build-and-push.sh index 53efd6adf2a6fdaf50576c4049857c1476e26958..2702e65cd6e1c2b5755f05a0b24eee48f4fdba81 100755 --- a/scripts/hab-build-and-push.sh +++ b/scripts/hab-build-and-push.sh @@ -22,9 +22,9 @@ ln -s "$(hab pkg path core/coreutils)/bin/env" /usr/bin/env hab pkg install -b core/coreutils core/bash core/node/8.11.3 core/git core/aws-cli npm ci -npm run build --output-path build -mkdir build/pages -mv build/*.html build/pages +npm run build +mkdir dist/pages +mv dist/*.html dist/pages aws s3 sync --acl public-read --cache-control "max-age=31556926" build/assets "$TARGET_S3_URL/assets" aws s3 sync --acl public-read --cache-control "no-cache" --delete build/pages "$TARGET_S3_URL/pages/latest" diff --git a/webpack.config.js b/webpack.config.js index bb9be202ded2fca453410c448f25d551a918b05b..b17d5a4ce2a6db3966d2b04ae7d70129a11cd1fd 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -81,7 +81,6 @@ module.exports = (env, argv) => ({ "avatar-selector": path.join(__dirname, "src", "avatar-selector.js") }, output: { - path: path.join(__dirname, "public"), filename: "assets/js/[name]-[chunkhash].js", publicPath: process.env.BASE_ASSETS_PATH || "" }, @@ -179,7 +178,7 @@ module.exports = (env, argv) => ({ use: { loader: "file-loader", options: { - // move required assets to /public and add a hash for cache busting + // move required assets to output dir and add a hash for cache busting name: "[path][name]-[hash].[ext]", // Make asset paths relative to /src context: path.join(__dirname, "src")