Commit Graph

573 Commits

Author SHA1 Message Date
Christian Brüggemann 3aac3350a8
Fix compilation of projects where dependsOn is an array
An entrypoint can be defined with `dependOn` specified as an array (see docs)[https://webpack.js.org/configuration/entry-context/#entry], for example:

```javascript
 splitmodule1: {
                import: scanSourceFiles('./src/splitmodule1'),
                dependOn: [ 'pluginregistry'] // Note that we could specify multiple dependencies here, e.g. dependOn: ['core', 'pluginregistry']
 }
```
Using the Webpack Watcher results in the following error:

```
× 「wdm」: Error: Conflicting entry option dependOn = pluginregistry vs pluginregistry
    at Compilation._addEntryItem (C:\Users\c.brueggemann\Documents\Projects\codesplit\node_modules\webpack\lib\Compilation.js:1616:7)
    at Compilation.addEntry (C:\Users\c.brueggemann\Documents\Projects\codesplit\node_modules\webpack\lib\Compilation.js:1560:8)
    at C:\Users\c.brueggemann\Documents\Projects\codesplit\node_modules\webpack\lib\DynamicEntryPlugin.js:59:23
    at new Promise (<anonymous>)
    at C:\Users\c.brueggemann\Documents\Projects\codesplit\node_modules\webpack\lib\DynamicEntryPlugin.js:58:10
```

This PR fixes the crash by comparing the arrays deeply instead of using incorrectly comparing them using `===`. I'm not too familiar with Webpack, so I'll be happy to adjust according to feedback.
2020-10-06 16:28:06 +02:00
Tobias Koppers 07fc554bef improve warnings and errors handling in stats
respect warningsFilter for warnings count
include child compilation warnings and errors in count
show hint for child compilation errors and warnings
2020-09-20 21:24:15 +02:00
Tobias Koppers ed06a7f83a new Worker() support
add support for async anonymous entrypoints from inside the codebase
add worker example
move entry options into Entrypoint and receive them from there
2020-09-08 07:37:20 +02:00
Tobias Koppers b6bfe8b891 fix auxiliary files for Compilation.renameAsset 2020-09-03 23:24:16 +02:00
Tobias Koppers 8497cd34c6 move start and endTime from Stats to Compilation 2020-09-03 22:01:25 +02:00
Tobias Koppers 0f089187e4 improve hashing of runtime modules that need a full hash 2020-09-01 18:31:29 +02:00
Tobias Koppers be021e00f4 add grouping of modules 2020-09-01 18:31:22 +02:00
Tobias Koppers dff76973e4 type fixes 2020-08-24 18:35:28 +02:00
Tobias Koppers cee47dc867 Store cache dependencies inside of Snapshot to reduce cache size 2020-08-24 18:16:54 +02:00
Tobias Koppers 114154099c avoid merging LazySets from factory results 2020-08-24 18:16:52 +02:00
Tobias Koppers 6409463d24 only create shared snapshots for 3 or more shared entries
add logging
2020-08-24 18:16:50 +02:00
Tobias Koppers b929d4cdce calculate real content hash for assets after asset processing 2020-08-18 22:07:24 +02:00
Tobias Koppers 62ccae1abd build errors should be errors even for optional modules
optional modules should only treat "not found" errors as warnings

fixes #9161
2020-08-14 20:03:48 +02:00
Tobias Koppers f9fe121fc8 improve and add statistics 2020-08-14 10:51:12 +02:00
Tobias Koppers a42e636a9c handle case where assets are related from multiple assets 2020-08-07 15:24:49 +02:00
Tobias Koppers 84aeac5c92 add Compilation.deleteAsset 2020-08-06 09:55:18 +02:00
Tobias Koppers f5bd6216aa add related info to asset info 2020-08-02 07:36:05 +02:00
Tobias Koppers fdfaa2efa0
Merge pull request #11252 from webpack/improve/cache-and-progress
do cache related tasks after calling handler in watching
2020-08-01 19:11:48 +02:00
Tobias Koppers ca369f23c5 do cache related tasks after calling handler in watching
improve progress output
2020-08-01 09:00:17 +02:00
Tobias Koppers 9e81495f7b add useful error messages for runtime and dependsOn 2020-08-01 06:43:16 +02:00
Tobias Koppers 216ab35823 avoid storing code generation result on errors 2020-07-28 22:09:31 +02:00
Tobias Koppers 3465b00a62 performance, cleanup 2020-07-28 22:05:13 +02:00
Tobias Koppers 1265765141 polish, types 2020-07-27 22:41:04 +02:00
Tobias Koppers e16bdfda6c refactor used exports analysis, hashing, code generation, optimizations
to keep track of runtimes, used exports depending on runtime

modules can have different hashes and generated code depending on runtime
chunks are only considered as equal for MergeDuplicateChunks and SplitChunks when exports used in contained modules are equal
added `optimization.usedExports: "global"` to opt-out from used exports analysis per runtime
added `splitChunks.usedExports` and `splitChunks.cacheGroups[x].usedExports` to enable/disable used exports comparing for modules
`splitChunks.usedExports` defaults to `true` in production
2020-07-27 22:40:44 +02:00
Tobias Koppers b3466e996b add entry[x].runtime option to allow runtime chunk per entry 2020-07-27 22:40:40 +02:00
Tobias Koppers 36cf3039aa use content hashes for assets 2020-07-20 08:45:27 +02:00
Tobias Koppers b1eac4ab29 Use computed resolve options in context alternatives
deprecate ContextModuleFactory.hooks.alternatives because we need the options in the hook
2020-07-15 14:13:35 +02:00
Tobias Koppers fd9b399ae9 Create Cache facade to make it easier to use
add missing serializers for classes used in test suite
2020-07-15 11:14:28 +02:00
Tobias Koppers 555db6a547 remove Compilation.modifyHash
refactor HMR Plugin to better support module hashes

fixes bug that causes empty HMR manifest
remove HotModuleReplacementPlugin multiStep
2020-07-09 09:02:38 +02:00
Tobias Koppers 23f922bed3 make bundles with Module Federation more stable 2020-07-02 15:28:17 +02:00
Tobias Koppers 4c1ad1ee7d reduce calls to getter 2020-06-17 23:01:18 +02:00
Ivan Kopeykin 198e51a485 Merge branch 'master' into exports-field
# Conflicts:
#	lib/dependencies/ImportDependency.js
#	lib/sharing/ConsumeSharedPlugin.js
#	lib/sharing/ProvideSharedPlugin.js
#	types.d.ts
2020-06-16 21:16:41 +03:00
Tobias Koppers c00fec3aa7
Merge pull request #10964 from pushkar100/feature/lazy-load-named-exports
Lazy loading only required exports from dynamic import()
2020-06-16 15:04:06 +02:00
Pushkar DK 31e3369a73 Add 'webpackExports' & make only referenced exports available in import() 2020-06-06 00:11:21 +05:30
Ryan Graff 8cebd62722
chore(Compilation EntryData includeDependencies):
Correct a grammatical error in the description.
2020-06-05 00:42:33 -04:00
Tobias Koppers 3df380e2d7 add script external
change defaults of ModuleFederationPlugin to var library and script remoteType
allow using empty entry in config
2020-06-04 03:18:07 +02:00
Ivan Kopeykin 57bd6ed348 Merge branch 'master' into exports-field
# Conflicts:
#	lib/container/OverridablesPlugin.js
2020-06-01 15:14:47 +03:00
Ivan Kopeykin a7b85301a7 add explanation for processDependency method 2020-05-31 00:56:12 +03:00
Ivan Kopeykin 4af609a38c fix resource identifier in Compilation and resolveLoader options 2020-05-28 10:53:28 +03:00
Ivan Kopeykin 0dd9aaf25b fix combining dependencies in Compilation
remove extra layer, use concatenated key instead
2020-05-28 01:23:54 +03:00
Ivan Kopeykin 8c1d64c5fd rework how condition names pass to resolve option 2020-05-27 02:27:52 +03:00
Tobias Koppers e44e51fa5b bugfix some edge cases 2020-05-26 18:08:16 +02:00
Tobias Koppers a468cbbd2e add provide shared module plugin 2020-05-23 16:08:51 +02:00
Tobias Koppers 49752a06a8 cleanup asset processing
deprecate writing to compilation.assets after sealing.
merge all asset processing into single hook with stages.
Deprecate additionalChunkAssets and optimizeChunkAssets.
Redirect additionalAssets, optimizeAssets to processAssets for backward-compat.
Remove finishAssets hook without deprecation as it was not in v4.
2020-05-22 10:39:21 +02:00
Tobias Koppers 15eefadcea
Merge pull request #10838 from webpack/dev-1
Merge Module Federation into webpack 5 beta
2020-05-05 23:57:00 +02:00
Tobias Koppers 93fddc0680 remove logic to finish modules in module graph 2020-05-05 22:12:27 +02:00
Tobias Koppers 24d1ca50b7 generate useful module ids for container-related modules 2020-05-05 21:51:17 +02:00
Tobias Koppers 50ec72a6ca use the full hash on modules that need the full hash of the compilation
use getFullHash runtime module for updating the hash in HMR
2020-04-30 17:57:01 +02:00
Ivan Kopeykin 0549f28e49 fix #10725 2020-04-26 18:40:12 +03:00
evilebottnawi dafa4cd69a chore: setup cspell 2020-03-12 19:51:26 +03:00