1.24.9 • Published 3 months ago

@crasman/stage-webpack v1.24.9

Weekly downloads
43
License
MIT
Repository
-
Last release
3 months ago

stage-webpack

Webpack bundling processes desgined to work well with Stage / Studio environment

Installation

This is installed automatically if you use @crasman/create-stage-webpack to create new project, also the configuration is taken care of.

To install manually run npm install stage-webpack --save-dev

Configuration

Config file (stage-webpack.config.js) needs to be found in project root folder. See config documentation

You also need to setup linters and build process configuration. Click links for examples on how to use and extend stage-webpack defaults:

These files should be stored in the root of your project.

Service worker setup

If defined (config.files.serviceWorker), we expect to find self.__WB_MANIFEST in the service worker file for precaching built assets. Example service-worker.js setup

Extending stage-webpack.config.js

You can extend project settings with local ones by placing another stage-webpack.config.js file outside of the project folder. This way you can generate valid SSL certificate that you can use for all your stage-webpack dev servers.

Scripts

  • stage-webpack start: Start dev server. Change proxy target with --sw-stage-url <config.stage.urls[target]>. E.g. stage-webpack-scripts start --sw-stage-url admin
  • stage-webpack build: Build files and upload to Studio
  • stage-webpack watch: Dev version of build. Should only be used when dev server can't be used, for example when developing Prince XML which requires that server has access to needed files.
  • stage-webpack update-project: Can be used to apply automatic fixes to source files if there are any available

Client environment variables

Exposed to client:

  • PUBLIC_PATH: Can be used to register service worker etc.
  • NODE_ENV: 'production', 'development' or 'test'
  • DEV_SERVER: undefined or 'true'
  • SW_<anything>: Any env variable prefixed with SW_ can be used in client code. E.g SW_TEST = 'test' can be accessed with process.env.SW_TEST

Development

Linking to test project for Webpack testing

Link @crasman/stage-webpack

Just run npm link inside packages/stage-webpack folder

Link to your test project

This is little tricky to link thanks to how npm link now works (>= 7.0.0). Step 4 works around this new limitation by installing all other monorepo packages as dependencies.

  1. Go to your project's folder
  2. Switch to same Node version as you use for @crasman/stage-webpack developing
  3. Remove node_modules and package-lock.json and run npm install if you needed to change Node version
  4. npm install @crasman/babel-preset-stage-webpack @crasman/branch-bar @crasman/eslint-config-stage-webpack @crasman/stylelint-config-stage-webpack
  5. npm link @crasman/stage-webpack
  6. Start testing Webpack functionality
1.24.9

3 months ago

1.24.8

5 months ago

1.24.6-alpha.0

5 months ago

1.24.6

5 months ago

1.24.5

6 months ago

1.24.3

1 year ago

1.24.2

2 years ago

1.24.1

2 years ago

1.23.2-alpha.1

2 years ago

1.23.2-alpha.0

2 years ago

1.23.1-alpha.0

2 years ago

1.24.0

2 years ago

1.23.0

2 years ago

1.20.0-alpha.8

2 years ago

1.20.0-alpha.6

2 years ago

1.20.0-alpha.7

2 years ago

1.20.0-alpha.4

2 years ago

1.20.0-alpha.5

2 years ago

1.21.0

2 years ago

1.20.0-alpha.2

2 years ago

1.20.0-alpha.3

2 years ago

1.20.0-alpha.0

2 years ago

1.20.0-alpha.1

2 years ago

1.21.2

2 years ago

1.21.0-alpha.0

2 years ago

1.21.0-alpha.1

2 years ago

1.20.1

2 years ago

1.20.0

2 years ago

1.19.3

3 years ago

1.19.2

3 years ago

1.18.0

3 years ago

1.17.3

3 years ago

1.17.1

3 years ago

1.17.0

3 years ago

1.16.0

3 years ago

1.15.5-test.0

3 years ago

1.15.4-test.0

3 years ago

1.15.2

3 years ago

1.15.1

3 years ago

1.16.0-alpha.0

3 years ago

1.15.0

3 years ago

1.14.2

3 years ago

1.14.0

3 years ago

1.13.1

4 years ago

1.13.0

4 years ago

1.12.0

4 years ago

1.11.1

4 years ago

1.11.0

4 years ago

1.10.2

4 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.8.6

4 years ago

1.8.5

4 years ago

1.8.4

4 years ago

1.8.1

4 years ago

1.8.3

4 years ago

1.8.0

4 years ago

1.6.2

4 years ago

1.5.2

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.6

4 years ago

0.1.2

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.1.0-0

4 years ago