Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Update to webpack 4 #809

Merged
merged 20 commits into from
Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b4ead6c
Update existing dependencies
edmorley Apr 20, 2018
1212d64
Adjust api_test.js no entry-point expected error message
edmorley Apr 20, 2018
f23bbec
Update webpack-chain.md with upstream changes
edmorley Apr 20, 2018
2124e19
Set the new webpack 4 'mode' option appropriately
edmorley Apr 20, 2018
36bf6f1
Remove explicit ModuleConcatenationPlugin usage
edmorley Apr 20, 2018
3ed583f
Replace @neutrinojs/chunk with splitChunks
edmorley Apr 20, 2018
76ba092
Remove default of NODE_ENV from @neutrinojs/env
edmorley Apr 20, 2018
ad158db
Use uglify-es instead of babel-minify by default
edmorley Apr 20, 2018
a0aa6db
Abort the build if a 'vendor' entrypoint detected
edmorley Apr 20, 2018
62e8843
Replace extract-text-webpack-plugin with mini-css-extract-plugin
edmorley Apr 20, 2018
1541d22
Add workaround for karma-webpack incompatibilities with webpack 4
edmorley Apr 20, 2018
442e2f8
Add more tests for the web/node/library presets
edmorley Apr 20, 2018
65f77a3
Remove @neutrinojs/babel-minify
edmorley Apr 24, 2018
8bc0d3b
Stop pinning webpack-sources to v1.0.1
edmorley Apr 24, 2018
ca030ac
Regenerate yarn.lock
edmorley Apr 24, 2018
f8dd6c9
Remove minify.babel option remnant
edmorley Apr 25, 2018
902f2fa
Make legacy minify option checks more thorough
edmorley Apr 25, 2018
3aeb816
Remove babel-minify example and link to sourcemaps bug
edmorley Apr 25, 2018
5ec4711
Only use @neutrinojs/env if envs were specified
edmorley Apr 25, 2018
984288b
Add missing trailing semicolon
edmorley Apr 25, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
* [Karma](./packages/karma/README.md)
* [Mocha](./packages/mocha/README.md)
* [Jest](./packages/jest/README.md)
* [babel-minify](./packages/babel-minify/README.md)
* [banner](./packages/banner/README.md)
* [chunk](./packages/chunk/README.md)
* [clean](./packages/clean/README.md)
* [compile-loader](./packages/compile-loader/README.md)
* [copy](./packages/copy/README.md)
Expand Down
97 changes: 0 additions & 97 deletions docs/packages/babel-minify/README.md

This file was deleted.

78 changes: 0 additions & 78 deletions docs/packages/chunk/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions docs/packages/library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,6 @@ _Note: Some plugins are only available in certain environments. To override them
| --- | --- | --- |
| `banner` | Injects source-map-support into the main entry points of your application if detected in `dependencies` or `devDependencies` of your package.json. | Only when `source-map-support` is installed |
| `clean` | Clears the contents of `build` prior to creating a production bundle. | `build` command |
| `babel-minify` | Minifies source code using `BabelMinifyWebpackPlugin`. From `@neutrinojs/babel-minify`. | `NODE_ENV production` |
| `module-concat` | Concatenate the scope of all your modules into one closure and allow for your code to have a faster execution time in the browser. | `NODE_ENV production` |

### Override configuration

Expand Down
1 change: 0 additions & 1 deletion docs/packages/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ _Note: Some plugins are only available in certain environments. To override them
| `start-server` | Start a Node.js for the first configured main entry point. | `start` command |
| `hot` | Enables Hot Module Replacement. | `start` command |
| `named-modules` | Enables named modules for improved debugging and console output. From `@neutrinojs/hot`. | `start` command |
| `module-concat` | Concatenate the scope of all your modules into one closure and allow for your code to have a faster execution time in the browser. | `NODE_ENV production` |

### Override configuration

Expand Down
17 changes: 11 additions & 6 deletions docs/packages/preact/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- Pre-configured to support CSS Modules via `*.module.css` file extensions
- Hot Module Replacement support including CSS
- Tree-shaking to create smaller bundles
- Production-optimized bundles with Babel minification, easy chunking, and scope-hoisted modules for faster execution
- Production-optimized bundles with minification, easy chunking, and scope-hoisted modules for faster execution
- Easily extensible to customize your project as needed

## Requirements
Expand Down Expand Up @@ -254,19 +254,24 @@ array. You can also make these changes from the Neutrino API in custom middlewar

#### Vendoring

By defining an entry point named `vendor` you can split out external dependencies into a chunk separate
from your application code.
External dependencies are automatically split into separate chunks from the application code,
by the new webpack [SplitChunksPlugin](https://webpack.js.org/plugins/split-chunks-plugin/).

_Example: Put Preact into a separate "vendor" chunk:_
_Example: The splitChunks settings can be adjusted like so:_

```js
module.exports = {
use: [
'@neutrinojs/preact',
(neutrino) => {
neutrino.config
.entry('vendor')
.add('preact');
.optimization
.merge({
splitChunks: {
// Decrease the minimum size before extra chunks are created, to 10KB
minSize: 10000
}
});
}
]
};
Expand Down
2 changes: 1 addition & 1 deletion docs/packages/react-components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ other Neutrino middleware, so you can build, test, and publish multiple React co
- Pre-configured to support CSS Modules via `*.module.css` file extensions
- Hot Module Replacement support including CSS
- Tree-shaking to create smaller bundles
- Production-optimized bundles with Babel minification, easy chunking, and scope-hoisted modules for faster execution
- Production-optimized bundles with minification, easy chunking, and scope-hoisted modules for faster execution
- Easily extensible to customize your project as needed

**Important! This preset does not include babel-polyfill for size reasons. If you need
Expand Down
22 changes: 14 additions & 8 deletions docs/packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- Pre-configured to support CSS Modules via `*.module.css` file extensions
- Hot Module Replacement support including CSS
- Tree-shaking to create smaller bundles
- Production-optimized bundles with Babel minification, easy chunking, and scope-hoisted modules for faster execution
- Production-optimized bundles with minification, easy chunking, and scope-hoisted modules for faster execution
- Easily extensible to customize your project as needed

## Requirements
Expand Down Expand Up @@ -266,19 +266,25 @@ module.exports = {

#### Vendoring

By defining an entry point named `vendor` you can split out external dependencies into a chunk separate
from your application code.
External dependencies are automatically split into separate chunks from the application code,
by the new webpack [SplitChunksPlugin](https://webpack.js.org/plugins/split-chunks-plugin/).

_Example: Put React and React DOM into a separate "vendor" chunk:_
_Example: The splitChunks settings can be adjusted like so:_

```js
module.exports = {
use: [
'@neutrinojs/react',
(neutrino) => neutrino.config
.entry('vendor')
.add('react')
.add('react-dom')
(neutrino) => {
neutrino.config
.optimization
.merge({
splitChunks: {
// Decrease the minimum size before extra chunks are created, to 10KB
minSize: 10000
}
});
}
]
};
```
Expand Down
19 changes: 8 additions & 11 deletions docs/packages/style-loader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ neutrino.use(styles, {
ruleId: 'style',
styleUseId: 'style',
cssUseId: 'css',
hotUseId: 'hot',
hot: true,
modules: true,
modulesSuffix: '-modules',
modulesTest: /\.module.css$/,
extractId: 'extract',
extract: {
plugin: {},
loader: {}
loader: {
filename: neutrino.options.command === 'build' ? '[name].[contenthash].css' : '[name].css'
}
}
});
```
Expand All @@ -89,15 +89,15 @@ module.exports = {
ruleId: 'style',
styleUseId: 'style',
cssUseId: 'css',
hotUseId: 'hot',
hot: true,
modules: true,
modulesSuffix: '-modules',
modulesTest: /\.module.css$/,
extractId: 'extract',
extract: {
plugin: {},
loader: {}
loader: {
filename: neutrino.options.command === 'build' ? '[name].[contenthash].css' : '[name].css'
}
}
}]
]
Expand All @@ -111,8 +111,6 @@ module.exports = {
- `ruleId`: The ID of the webpack-chain rule used to identify the stylesheet loaders
- `styleUseId`: The ID of the webpack-chain `use` used to identify the style-loader
- `cssUseId`: The ID of the webpack-chain `use` used to identify the css-loader
- `hotUseId`: The ID of the webpack-chain `use` used to identify the css-hot-loader
- `hot`: Enable usage of CSS Hot Module Replacement. Set to `false` to disable.
- `modules`: Enable usage of CSS modules via `*.module.css` files. Set to `false` to disable and skip defining these rules.
- `modulesSuffix`: A suffix added to `ruleId`, `styleUseId`, `cssUseId`, `hotUseId`, and `extractId` to derive names for
modules-related rules. For example, the default `-modules` suffix will generate a rule ID for the CSS modules rules of
Expand Down Expand Up @@ -234,8 +232,8 @@ The following is a list of default rules and their identifiers which can be over

| Name | Description | Environments and Commands |
| --- | --- | --- |
| `style` | Allows importing CSS stylesheets from modules. Contains two loaders named `style` and `css` which use `style-loader` and `css-loader`, respectively. | all |
| `style-modules` | Allows importing CSS Modules styles from modules. Contains two loaders named `style-modules` and `css-modules` which use `style-loader` and `css-loader`, respectively. | all |
| `style` | Allows importing CSS stylesheets from modules. By default contains two loaders named `extract` and `css` which use `MiniCssExtractPlugin.loader` and `css-loader`, respectively. If `options.extract` is `false`, then the `extract` loader is replaced by `style`, which uses `style-loader`. | all |
| `style-modules` | Allows importing CSS Modules styles from modules. By default contains two loaders named `extract` and `css` which use `MiniCssExtractPlugin.loader` and `css-loader`, respectively. If `options.extract` is `false`, then the `extract` loader is replaced by `style`, which uses `style-loader`. | all |

### Plugins

Expand All @@ -246,7 +244,6 @@ _Note: Some plugins may be only available in certain environments. To override t
| Name | Description | Environments and Commands |
| --- | --- | --- |
| `extract` | Extracts CSS from JS bundle into a separate stylesheet file. | all |
| `extract-modules` | Extracts CSS from JS bundle into a separate stylesheet file. | all |

## Contributing

Expand Down
17 changes: 11 additions & 6 deletions docs/packages/vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- Pre-configured to support CSS Modules via `*.module.css` file extensions
- Hot Module Replacement support including CSS
- Tree-shaking to create smaller bundles
- Production-optimized bundles with Babel minification, easy chunking, and scope-hoisted modules for faster execution
- Production-optimized bundles with minification, easy chunking, and scope-hoisted modules for faster execution
- Easily extensible to customize your project as needed

## Requirements
Expand Down Expand Up @@ -291,19 +291,24 @@ array. You can also make these changes from the Neutrino API in custom middlewar

#### Vendoring

By defining an entry point named `vendor` you can split out external dependencies into a chunk separate
from your application code.
External dependencies are automatically split into separate chunks from the application code,
by the new webpack [SplitChunksPlugin](https://webpack.js.org/plugins/split-chunks-plugin/).

_Example: Put Vue into a separate "vendor" chunk:_
_Example: The splitChunks settings can be adjusted like so:_

```js
module.exports = {
use: [
'@neutrinojs/vue',
(neutrino) => {
neutrino.config
.entry('vendor')
.add('vue');
.optimization
.merge({
splitChunks: {
// Decrease the minimum size before extra chunks are created, to 10KB
minSize: 10000
}
});
}
]
};
Expand Down
Loading