Commit Graph

276 Commits

Author SHA1 Message Date
Tobias Koppers d9c592738a refactor and add test cases
add `parser.exportPresence`, `parser.importExportPresence`, `parser.reeexportExportPresence` `"error" | "warn" | "auto" | false`
2021-11-02 18:29:47 +01:00
Tobias Koppers e189971705 Merge branch 'main' into mamolin/allow-ignore 2021-11-02 13:46:25 +01:00
Ivan Kopeykin 166be712c0 Merge branch 'main' into feature-14072
# Conflicts:
#	lib/dependencies/CachedConstDependency.js
#	schemas/WebpackOptions.check.js
2021-10-30 21:36:39 +03:00
Tobias Koppers ae52a74802 improve buildHttp
allow multiple configurations to write to the same lockfile
add allowedUris for allowlisting
add schema validation
2021-10-19 09:21:05 +02:00
Tobias Koppers 5e16d642ad allow RegExp as managed and immutable paths
add all node_modules as managedPaths in futureDefaults
2021-10-18 22:56:41 +02:00
Mark Molinaro b422943d2a Limit scope of changes to just HarmonyExportImportedSpecifierDependencies 2021-10-07 20:55:49 +00:00
Tobias Koppers 3b48429eb5 add MemCache for memory caching per module which is invalidated when module or any referenced modules changes
add `experiments.cacheUnaffected`
add `cache.cacheUnaffected` (type: memory) resp `cache.memoryCacheUnaffected` (type: filesystem)
2021-09-24 15:23:29 +02:00
Tobias Koppers da8e93af33 use xxhash64 for future defaults 2021-09-23 15:04:22 +02:00
Ivan Kopeykin 6c3a04d5ce add node-module option for node.__file/dirname
evaluate __filename and __dirname for common js modules when output.module to
fileURLToPath(import.meta.url) and fileURLToPath(import.meta.url + "/..") respectively
2021-09-14 16:50:03 +03:00
Ivan Kopeykin 5592f6616f add experiments.futureDefaults
futureDefaults applies next major defaults
adds node.global=warn
node.__filename=warn-mock
node.__dirname=warn-mock
2021-09-14 11:29:57 +03:00
Tobias Koppers 60408e1136 add importModule to loader context by default
always enable experiments.executeModule and remove it
2021-09-02 16:27:39 +02:00
Tobias Koppers abe5005aec disable cache compression by default
it has a negative performance impact in many cases
2021-08-10 13:04:43 +02:00
Tobias Koppers b6609a4f6b add `experiments.buildHttp`
allows to build remote resources
stores remote resources in a lockfile
2021-08-05 15:47:18 +02:00
Sven Sauleau 6c50c81350 Revert "Revert "Merge pull request #12278 from xtuc/sven/import-assertions""
This reverts commit 61946b7c46.
2021-07-24 23:28:30 +01:00
Tobias Koppers 61946b7c46 Revert "Merge pull request #12278 from xtuc/sven/import-assertions"
This reverts commit df02bc6c0a, reversing
changes made to a6f341e243.
2021-07-16 21:54:21 +02:00
Tobias Koppers 7f22e4721f match on asserts
change Map to Record
improve test case
2021-07-16 13:17:20 +02:00
Sven Sauleau b166f46f2c parse import assertions 2021-07-16 13:14:54 +02:00
Tobias Koppers 492055ae90 add cache compression 2021-07-02 07:05:13 +02:00
Tobias Koppers f7766875bc
Merge pull request #13649 from webpack/cache/automatic-store
store cache after large changes
2021-06-28 17:35:14 +02:00
Tobias Koppers 142bc5610f store cache after large changes
detect larger changes automatically and use shorter timeout
2021-06-28 11:35:14 +02:00
Tobias Koppers 15408018cb partially fix test cases 2021-06-24 10:05:37 +02:00
Tobias Koppers 4da99d8254 add `module` library support, test and example
add test cases for `experiments.outputModule`
2021-06-23 14:49:14 +02:00
Tobias Koppers 973edfbd1b support data urls as input in `new URL` 2021-05-19 11:30:09 +02:00
Tobias Koppers b0fa9ccada pretty files 2021-05-11 09:31:46 +02:00
Tobias Koppers 88da3f8ed2 normalize output.trustedTypes to an object 2021-05-10 10:34:21 +02:00
Tobias Koppers bb8ba1cd05 disable trustedTypes by default
allow to pass a boolean as trustedTypesPolicy
2021-05-10 09:02:46 +02:00
Krzysztof Kotowicz c816c135ca Removed a deprecated createURL function reference. 2021-05-04 16:06:37 +02:00
Tobias Koppers 9b57c3cb56 avoid complex "by exports" splitting for splitChunks in development mode 2021-04-28 09:10:44 +02:00
Tobias Koppers 766be5a3fd add cache.profile flag for more info about (de)serialization timings 2021-04-28 09:10:43 +02:00
Tobias Koppers be66dc6242 collect memory cache faster when using filesystem cache 2021-04-20 15:40:06 +02:00
Tobias Koppers 177736f59c avoid leaking unused memory in buffer backing stores in development mode 2021-04-20 15:22:16 +02:00
Tobias Koppers 21bc6e715b add support for a pseudo `.webpack[type]` extension allows to set module type when no other type is set from module.rules 2021-04-12 12:27:54 +02:00
Tobias Koppers f64f837629 tty detection uses provided stream 2021-04-06 15:23:22 +02:00
Tobias Koppers 4e117781e8 improvements
add appendOnly flag
add custom console
add custom stream
2021-04-06 15:20:27 +02:00
Hyeonmin Park 72ba68cc78 feat: add colors flag to infrastructureLogging 2021-04-04 14:28:31 +09:00
Tobias Koppers c84329f73c add GC to the memory cache and make it configurable
memory GC happens by default when persistent cache is enabled and in development mode
otherwise memory cache is kept forever

make maxAge for persistent cache configurable
GC the oldest content file even if it's not touched (to keep cache size small)

filesystem cache will now no longer cache in memory, but restore items from disk again when it was persisted
2021-04-01 17:12:53 +02:00
Tobias Koppers c18b3c53e5
Merge pull request #12832 from webpack/bugfix/array-default-fallback
fix array expansion when using "..."
2021-03-08 10:51:34 +01:00
Tobias Koppers e63e733713 fix array expansion when using "..." 2021-03-08 09:41:11 +01:00
Tobias Koppers 8dcb90dbbd avoid making the package.json in context a build dependency 2021-03-06 16:36:14 +01:00
Tobias Koppers 44b4e25b98 fixes for electron target
electron has `importScripts` in worker
only choose a chunkLoading which fits to the chunkFormat
prefer fetch wasm loading over node wasm loading
2021-02-15 17:19:08 +01:00
Tobias Koppers 0e63c0db0a fix infinite loop in defaulting 2021-02-05 20:09:50 +01:00
Bogdan Chadkin 2fa807ee42 Fix paren 2021-02-02 16:22:36 +03:00
Bogdan Chadkin 93ac58c64e Find package.json manually 2021-02-02 16:01:20 +03:00
Bogdan Chadkin 5717d826fc Suppress type error 2021-01-31 17:14:53 +03:00
Bogdan Chadkin b837b4c6d5 Replace pkg-dir with escalade
Escalade is small alternative to pkg-dir, find-up etc. without
dependencies. It's already used by browserslist.
2021-01-30 19:05:46 +03:00
Tobias Koppers 013ca3bdd7 add commonjsMagicComments options
move javascript related options from 'module' to 'module.parser.javascript'
2021-01-20 20:19:49 +01:00
Tobias Koppers aac7f2e619 allow to configure parsers and generators globally
get plugin schemas from root schema
normalize module.parser/generator
add test case
2021-01-05 12:08:30 +01:00
Tobias Koppers d46f945572 fix problem when HMR and different runtimes
allow HMR to work in WebWorkers too
2020-11-28 13:53:32 +01:00
Tobias Koppers e1b5a78a24 add optimization.sideEffects: "flag" and use this by default
analysing for side effects cause unnecessary changes in parent modules and we want to avoid that in development
2020-10-27 06:50:07 +01:00
Maya 906a447fab Fix require handling with electron; fixes #11599 2020-10-08 01:06:31 +02:00
Tobias Koppers 68f0dbe748 allow plugins to modify the default size types for splitChunks 2020-09-29 14:34:59 +02:00
Tobias Koppers 4ea79e0683 update enhanced-resolve and webpack-sources
add resolve.preferRelative
set preferRelative for new URL() and new Worker() to fix relative requests
2020-09-28 20:43:03 +02:00
Tobias Koppers 7597fe3baf make browserslist the default target when browserslist config is available 2020-09-28 13:48:13 +02:00
Tobias Koppers d6c7adf3fb throw error when no browserslist config found 2020-09-28 11:39:52 +02:00
Sergey Melyukov eb7e5c0fe9 (fix): remove path to browserslist module 2020-09-24 15:08:09 +03:00
Sergey Melyukov 3996c7d6d4 (fix): remove browserslist from default 2020-09-24 14:50:08 +03:00
Sergey Melyukov bdf3529021 (feat): improve browserslist support 2020-09-24 14:33:09 +03:00
Tobias Koppers f263359fd8 use output.importMetaName for import.meta 2020-09-18 10:55:37 +02:00
Tobias Koppers 5cf0b8288c improve detection when auto publicPath can be used 2020-09-18 10:31:07 +02:00
Ivan Kopeykin 580de0873a update publicPath
- support option output.publicPath="auto"
- add test cases
- render import.meta.url for output.scriptType="module"
2020-09-15 00:27:38 +03:00
Tobias Koppers bbdb33a5cf rename output.environment.import -> output.environment.dynamicImport 2020-09-11 23:11:02 +02:00
Tobias Koppers 7e85649492 improve target options
infer target properties from different targets and fill defaults from that

custom targets can now be created via `target: false` and a plugin (similar to the other options)

add stubs from universal chunk/wasm loading and module chunk format

add externalsPresets.electron and externalsPresets.electronRenderer

node.__file/dirname: "eval-only"
2020-09-10 11:42:09 +02:00
Tobias Koppers 48010fb955 replace output.ecmaVersion with output.environment and more detailed flags 2020-09-10 11:12:28 +02:00
Tobias Koppers 730aefef37
Merge pull request #11412 from webpack/experiments/enable-mjs
enable mjs experiment
2020-09-10 10:57:36 +02:00
Tobias Koppers eec6fbdd7c extract loader.target from target option 2020-09-09 19:04:30 +02:00
Tobias Koppers 817c1bf9c7 move default externals from target into externalsPresets option 2020-09-09 15:18:59 +02:00
Tobias Koppers aa67a435a4 refactor wasm loading from target into output.wasmLoading option
allow entry specific wasm loading
2020-09-09 11:20:37 +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 2d4c9da6a6 enable mjs experiment 2020-09-07 23:15:24 +02:00
Tobias Koppers 0111405198 enable asset experiment 2020-09-03 14:19:09 +02:00
Tobias Koppers 312e2ab587 Merge branch 'master' into feature/asset-url 2020-08-28 20:54:50 +02:00
Tobias Koppers 3c94cad7f1 use import-scripts chunk loading for webworker target 2020-08-28 11:27:32 +02:00
Tobias Koppers d5d2e3f244 use "self" as globalObject for web-like targets 2020-08-28 11:27:31 +02:00
Tobias Koppers 07d863e14c implement enabledChunkLoadingTypes approach
allow chunkLoading per entry
allow custom library/chunkLoading types
2020-08-28 10:59:37 +02:00
Tobias Koppers 805d26b0ae unify config options for jsonpFunction and chunkLoadFunction to chunkLoadingGlobal
rename hotUpdateFunction to hotUpdateGlobal
2020-08-28 10:58:00 +02:00
Tobias Koppers d6e637f33c add "snapshot" configuration to allow to configure how snapshots are created
expose snapshot options for module, resolve, buildDependencies and resolveBuildDependencies
move managedPaths and immutablePaths from config.cache to config.snapshot
add timestamp + hash snapshotting mode
use timestamp + hash mode by default in production and for buildDependencies
2020-08-26 01:27:13 +02:00
Tobias Koppers db36afea4d
Merge pull request #11333 from chenxsan/feature/output-charset
add output.charset option
2020-08-19 15:01:06 +02:00
Tobias Koppers b929d4cdce calculate real content hash for assets after asset processing 2020-08-18 22:07:24 +02:00
Tobias Koppers 71cf7f4dc8 add support for reexporting in CommonJS
and necessary refactoring + fixes for that
2020-08-17 21:32:47 +02:00
chenxsan fd19fa90b8 add output.charset option 2020-08-17 20:25:27 +08:00
Ivan Kopeykin 4157166263 Merge branch 'master' into feature/asset-url
# Conflicts:
#	test/Defaults.unittest.js
2020-08-16 15:47:05 +03:00
Ivan Kopeykin 69d69d6003 fix defaults: remove test condition for dependency=url 2020-08-06 21:07:18 +03:00
Ivan Kopeykin fcac182805 match dependency with Rule 2020-08-06 02:08:06 +03:00
Ivan Kopeykin ddc83b0d70 feat: url assets 2020-08-05 00:55:38 +03:00
Tobias Koppers a348f9558d
Merge pull request #10457 from webpack/feat-support-query-for-asset-modules
feat: support `[query]` for asset modules
2020-08-04 16:00:55 +02:00
Tobias Koppers dfc8e35f2d enable experiments.importAsync by default
remove experiments.importAwait
2020-08-04 00:47:08 +02:00
evilebottnawi 70b44a7f86 feat: support `[query]` for asset modules 2020-08-03 23:08:01 +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 1179a3eaab
Merge pull request #11188 from webpack/feature/mjs
improve compatibly with node.js ESM
2020-07-20 12:18:21 +02:00
Tobias Koppers f65adade96 deprecate optimization.noEmitOnErrors in favor of optimization.emitOnErrors 2020-07-20 08:40:31 +02:00
Tobias Koppers abb2a29748 improve wasm + mjs handling, remove .mjs from extensions 2020-07-17 15:57:56 +02:00
Tobias Koppers 205bbb4c0d improve compatibly with node.js ESM
improve experiments.mjs to be more compatibly with node.js ESM
  - add support for `type: "module"` in package.json
  - add support for `*.cjs`
  - enable strict ESM for data uris with `text/javascript` or `application/javascript`
  - disallow not fully specified requests in imports `*.mjs` or `type: "module"`

add `descriptionData` rule condition to match package.json info
fix passing resolveOptions along context modules
2020-07-17 13:58:29 +02:00
Tobias Koppers 336715f878 Only apply default js extensions when using a JS dependencyType 2020-07-15 14:13:34 +02:00
Tobias Koppers 565724a045 type fixes 2020-07-15 14:13:33 +02:00
Tobias Koppers 4e32a3f3de performance improvements
only add `browser` condition on web targets
default options should not share objects
check for "..." from reverse as this is more likly
2020-07-15 14:13:33 +02:00
Tobias Koppers 0d857e3942 Improve cleverMerge to respect byDependency order correctly
Allow to use "..." in `option.resolve` too
Add "..." to schema when needed

Apply dependency specific mainFields, aliasFields and conditionNames only
for cjs and esm dependencies or when none is specified for backward-compat.
2020-07-15 14:13:31 +02:00
Tobias Koppers b60fb2742a adjust splitChunks defaults for http/2 2020-07-13 10:13:55 +02:00
Tobias Koppers 6014ca7e86 splitChunks improvements
add new splitChunks.enforceSizeThreshold option
enforces splitting on certain size (ignoring maxRequests and minRemainingSize)

reduce default for splitChunks.minSize to 20k
set default for splitChunks.enforceSizeThreshold to 50k

fix bug where sorting didn't work for minSize: 0
2020-07-13 10:12:17 +02:00
Tobias Koppers 3d36f75f88
Merge pull request #11143 from vankop/add-roots
add roots option
2020-07-09 13:15:30 +02:00
Tobias Koppers 1de9e16858 create new array in defaults 2020-07-09 08:55:15 +02:00
Tobias Koppers 454bee59e6 disable used exports optimization in development to prevent unexpected changes to module 2020-07-09 08:46:43 +02:00
Ivan Kopeykin 38779b85ee add roots option 2020-07-09 00:17:57 +03:00
Sergey Melyukov 139da61b5f rename jsonScriptType to scriptType 2020-06-24 23:05:21 +03:00
Tobias Koppers 854c67b6b9
Merge pull request #11070 from webpack/feature/split-chunk-improvements
Feature/split chunk improvements
2020-06-24 11:09:24 +02:00
Tobias Koppers ba9027ac1a
Merge pull request #10719 from goganchic/feature/data-uri
Implement Data URI imports
2020-06-24 11:08:44 +02:00
Tobias Koppers 8d7c8986c6 use higher default limits for maxRequests
HTTP/2 first
2020-06-22 09:31:02 +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
Ivan Kopeykin 3f8def8185 fix discussions
- add module condition
- rename EnhancedResolveOptions
- fix applyByDependency util function
- use EMPTY_RESOLVE_OPTIONS when resolveOptions are undefined
2020-06-16 21:02:31 +03:00
Ivan Kopeykin 6146187ed2 rework defaults
defaults now align with webpack exports field guideline
2020-06-12 19:29:17 +03:00
goganchic 0ab91b7664 fix mimetype type description 2020-06-05 15:32:43 +03:00
Egor Baranov 04453aa4fb extend mimetype conditions
Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2020-06-05 15:15:11 +03:00
goganchic 4b59a302a2 add mimetype rule 2020-06-05 15:15:11 +03: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
Tobias Koppers 707a103262 merge resolve.byDependency defaults with user provided values
allow to use resolve.byDependency in module.rules
2020-05-28 19:55:14 +02:00
Ivan Kopeykin d4b1819749 add ability to set resolve options per dependency category
- byDependency option
- create resolver per dependency category
2020-05-28 02:30:29 +03:00
Ivan Kopeykin 2365361679 fix loader resolve options 2020-05-27 23:58:28 +03:00
Ivan Kopeykin bf3633ee1b add exportsFields and conditionNames options 2020-05-25 14:44:50 +03:00
Tobias Koppers a66290a15f add support for async externals
add `promise` external
add `import` external (uses import())

add `output.importFunctionName` option to change the `import()` function name

allow for inline external type when using arrays

fix some typings

fix namespace object behavior when using system external and accessing nested property
fix interop behavior for async dynamic modules
2020-05-19 17:25:43 +02:00
Tobias Koppers 3f9e6d5ec6 move tooling into separate repo, add type generation and test types 2020-04-21 09:25:38 +02:00
evilebottnawi dafa4cd69a chore: setup cspell 2020-03-12 19:51:26 +03:00
Tobias Koppers 88e6c5e2a7 add library option to entry description 2020-02-26 17:36:16 +01:00
Tobias Koppers f1dd328779 refactor library system 2020-02-26 17:35:52 +01:00
Tobias Koppers e5b51235d7 add externalsType option
fix a few edge cases in ExternalModule
2020-02-26 17:22:42 +01:00
Tobias Koppers bbb16e7af2 add output.uniqueName option
It defaults to library name or name from package.json in context

output.uniqueName will be used to generate unique globals for
* output.jsonpFunction
* output.chunkCallbackName
* etc.
2020-02-26 16:32:42 +01:00
Tobias Koppers c7b94a4274 improve caching support for PnP version 3 (yarn 2 berry) 2020-02-17 20:41:16 +01:00
Tobias Koppers 6477ca56f8 Split options defaulting in normalization and defaults
Apply defaults after plugins are applied to allow plugins to feature their own defaults.
This allows to make preset plugins.
2020-02-17 19:12:54 +01:00