-
Notifications
You must be signed in to change notification settings - Fork 32
Add configuration for vendor and commons chunk #417
Add configuration for vendor and commons chunk #417
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
Besides the comments I've add, it would be nice to have an integration test as well for vendor and common.
Wdyt?
README.md
Outdated
```js | ||
// sagui.config.js | ||
module.exports = { | ||
pages: ['index', { name: 'about', independent: true }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very small suggestion, but what about using a demo
or playground
in the name, to better hint this could be used for development pages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Will fix it.
README.md
Outdated
|
||
#### `vendor` | ||
|
||
If you want all your external dependencies in your [pages](#pages) to be bundled together in a "vendor" chunk, then set this flag to `true`. By default it is set to `false`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...external dependencies (node_modules
)...
src/configure-webpack/index.js
Outdated
@@ -19,7 +19,7 @@ import buildLoadersConfig from './loaders' | |||
* @return ready to use webpack configuration as an array | |||
*/ | |||
export default (saguiConfig = {}) => { | |||
const { pages = [], libraries = [], ...sharedSaguiConfig } = saguiConfig | |||
const { pages = [], libraries = [], chunks = {}, ...sharedSaguiConfig } = saguiConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need to extract chunks
here. Just let it in the sharedSaguiConfig
.
Then, you can remove the extra parameter you've add (chunks
) in a couple of places.
Makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix it
const common = plugins[1] | ||
|
||
expect(vendor.selectedChunks[0]).equal('index') | ||
expect(vendor.selectedChunks[2]).equal(undefined) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe test the length of the selectedChunks
here to be equal 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason there's an undefined
on every other position in the array, so it will actually be 2. Will check that.
@pirelenito I'd appreciate your help with the integration tests. |
79ad537
to
5884302
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the PR with integration tests! Should be ready to merge and release!
Thanks a lot @Deschtex ❤️
Closes #415