partey_workadventure/website
dependabot[bot] 78e7f481d5
Bump elliptic from 6.4.1 to 6.5.3 in /website
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.4.1 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.4.1...v6.5.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-08 10:04:29 +00:00
..
dist Adding the notion of silent zone 2020-08-31 14:10:01 +02:00
src Adding documentation page regarding editing your own map 2020-07-05 19:08:37 +02:00
.gitignore Renaming landing_page directory to website 2020-06-04 14:06:50 +02:00
Dockerfile Renaming landing_page directory to website 2020-06-04 14:06:50 +02:00
package-lock.json Bump elliptic from 6.4.1 to 6.5.3 in /website 2020-10-08 10:04:29 +00:00
package.json Renaming landing_page directory to website 2020-06-04 14:06:50 +02:00
postcss.config.js Renaming landing_page directory to website 2020-06-04 14:06:50 +02:00
README.md Renaming landing_page directory to website 2020-06-04 14:06:50 +02:00
webpack.config.js Renaming landing_page directory to website 2020-06-04 14:06:50 +02:00
yarn-error.log Renaming landing_page directory to website 2020-06-04 14:06:50 +02:00

Basic Webpack config for simple website.

Install all packages:

$ npm install

Run webpack

$ npm run build

Done! Open index.html in browser for a cat image.


Notice about production mode and postcss.config.js

In postcss.config.js there is a check for process.env.NODE_ENV variable. The thing is even if you set Webpack mode to production it won't automatically change Node environment variable.

The simplest way to configure this is to install cross-env package:

$ npm install --save-dev cross-env

Then just add another npm script in package.json for production mode:

"scripts": {
  "build": "webpack --config webpack.config.js",
  "build-production": "cross-env NODE_ENV=production webpack --config webpack.config.js"
}

Now when you run npm run build-production the process.env.NODE_ENV variable will be production and postcss.config.js check is going to work:

if(process.env.NODE_ENV === 'production') {
    module.exports = {
        plugins: [
            require('autoprefixer'),
            require('cssnano')
        ]
    }
}

From Webpack documentation: Technically, NODE_ENV is a system environment variable that Node.js exposes into running scripts. It is used by convention to determine dev-vs-prod behavior by server tools, build scripts, and client-side libraries. Contrary to expectations, process.env.NODE_ENV is not set to "production" within the build script webpack.config.js. Thus, conditionals like process.env.NODE_ENV === 'production' ? '[name].[hash].bundle.js' : '[name].bundle.js' within webpack configurations do not work as expected.