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

Remove default CopyPlugin from src/static/ to build/static/ #814

Merged
merged 1 commit into from
Apr 23, 2018
Merged

Remove default CopyPlugin from src/static/ to build/static/ #814

merged 1 commit into from
Apr 23, 2018

Conversation

edmorley
Copy link
Member

Since for most assets users should be importing in the build, and for the valid use-cases of not doing that (eg robots.txt), this default plugin didn't help anyway.

Another step forwards in making Neutrino default to fulfilling the 80% case, and then leaving the 20% to opt-in middleware, rather than having too much enabled by default.

@edmorley edmorley self-assigned this Apr 23, 2018
Copy link
Member

@eliperelman eliperelman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Since for most assets users should be importing in the build, and
for the valid use-cases of not doing that (eg `robots.txt`), this
default plugin didn't help anyway.
@edmorley edmorley merged commit 857df51 into neutrinojs:master Apr 23, 2018
@edmorley edmorley deleted the rm-copy-static branch April 23, 2018 21:25
@edmorley edmorley added this to the v9 milestone Apr 24, 2018
@constgen
Copy link
Contributor

But @neutrinojs/copy will stay in the core in case somebody will use it, will it?

@edmorley
Copy link
Member Author

edmorley commented Apr 26, 2018

It's still in the repo now, yes.

Though longer term I think we need to decide whether these micro presets are really worth it.

In the case of @neutrinojs/copy all it saves is:

const CopyPlugin = require('copy-webpack-plugin');
neutrino.config.plugin('copy').use(CopyPlugin, [patterns, options]);

...which isn't much more harder to understand than:

const copy = require('@neutrinojs/copy');
neutrino.use(copy, { patterns: [], options: {}});

The same applies to @neutrinojs/env now that webpack 4 sets NODE_ENV automatically, and so the preset no longer needs to include that entry itself.

All of these layers of abstraction make fully understanding what's going on harder than it need be IMO. One ends up having to learn {webpack, specific webpack plugin options, how neutrino wraps those plugins and passes the options on} - rather than just the first two.

@constgen
Copy link
Contributor

constgen commented May 4, 2018

Makes sense

@davidje13
Copy link
Contributor

For those poor saps like me experimenting with updating to v9, could you add the old configuration to the migration guide so that it's easy to maintain old behaviour? There are a lot of breaking changes and the more I can just patch with quick fixes the better.

From looking at the PR I believe the code is:

neutrino.use(copy, {
  patterns: [{
    context: 'src/static',
    from: '**/*',
    to: 'static',
  }],
});

Or equivalently:

['@neutrinojs/copy', {
  patterns: [{
    context: 'src/static',
    from: '**/*',
    to: 'static',
  }],
}],

(plus a new dependency on @neutrinojs/copy)

edmorley added a commit that referenced this pull request Mar 24, 2019
)

- Improve documentation based in feedback in #1129.
- Add checks for the legacy Neutrino `options.host` and `options.port`,
  since they were removed in #852.

Refs:
#1129 (comment)
#1129 (comment)
#814 (comment)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

4 participants