Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow omitting options to plugin-webpack #1047

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 19 additions & 4 deletions plugins/plugin-webpack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,35 @@

Use Webpack to bundle your application for production.

### Install

```
npm install --save-dev @snowpack/plugin-webpack
```

```js
// snowpack.config.json
### Usage

Add `@snowpack/plugin-webpack` to `snowpack.config.json`:

```json
{
"plugins": [["@snowpack/plugin-webpack", { /* see "Plugin Options" below */}]]
"plugins": [["@snowpack/plugin-webpack", { /* see "Plugin Options" below */ }]]
}
```

#### Default Build Script
or to `snowpack.config.js`:

```js
module.exports = {
plugins: [["@snowpack/plugin-webpack", { /* see "Plugin Options" below */ }]]
}
```

The options object is optional.

### Default Build Script

```json
{
"scripts": {"bundle:*": "@snowpack/plugin-webpack"}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/plugin-webpack/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function getSplitChunksConfig({ numEntries }) {
};
}

module.exports = function plugin(config, args) {
module.exports = function plugin(config, args = {}) {
// Deprecated: args.mode
if (args.mode && args.mode !== "production") {
throw new Error("args.mode support has been removed.");
Expand Down