8000 feat(webpack): add support for `module-browser` field by dmbch · Pull Request #73 · untool/untool · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 1, 2021. It is now read-only.

feat(webpack): add support for module-browser field #73

Closed
wants to merge 2 commits into from
Closed
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
8000
Diff view
1 change: 1 addition & 0 deletions packages/webpack/lib/configs/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module.exports = function getConfig(config, configureBuild) {
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down
1 change: 1 addition & 0 deletions packages/webpack/lib/configs/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module.exports = function getConfig(config, configureBuild) {
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack/lib/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const isLocal = (path) => !path.includes('node_modules');
const isShim = (path) => path.startsWith(join(dirname(__dirname), 'shims'));
const isMixin = (path) => /mixin(\.[a-z]+)?\.js$/.test(path);
const isModule = (path) =>
/"((e|j)snext(:[a-z]+)?|module|mixin(:[a-z]+)?)": ?"/m.test(
/"((e|j)snext(:[a-z]+)?|module(-[a-z]+)?|mixin(:[a-z]+)?)": ?"/m.test(
readFile(findUp('package.json', { cwd: dirname(path) }), 'utf8')
);
const isExpression = (path) => /[!?]/.test(path);
Expand Down
2 changes: 2 additions & 0 deletions tests/snapshots/build-p.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ Generated by [AVA](https://ava.li).
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down Expand Up @@ -986,6 +987,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
},
Expand Down
Binary file modified tests/snapshots/build-p.js.snap
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/snapshots/build-ps.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ Generated by [AVA](https://ava.li).
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down Expand Up @@ -990,6 +991,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
},
Expand Down
Binary file modified tests/snapshots/build-ps.js.snap
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/snapshots/build-s.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ Generated by [AVA](https://ava.li).
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down Expand Up @@ -988,6 +989,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
},
Expand Down
Binary file modified tests/snapshots/build-s.js.snap
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/snapshots/build.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ Generated by [AVA](https://ava.li).
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down Expand Up @@ -984,6 +985,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
},
Expand Down
Binary file modified tests/snapshots/build.js.snap
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/snapshots/develop-s.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,7 @@ Generated by [AVA](https://ava.li).
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down Expand Up @@ -1076,6 +1077,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
watchOptions: {
Expand Down
Binary file modified tests/snapshots/develop-s.js.snap
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/snapshots/develop.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,7 @@ Generated by [AVA](https://ava.li).
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down Expand Up @@ -1076,6 +1077,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
watchOptions: {
Expand Down
Binary file modified tests/snapshots/develop.js.snap
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/snapshots/start-p.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ Generated by [AVA](https://ava.li).
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down Expand Up @@ -1152,6 +1153,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
},
Expand Down Expand Up @@ -1681,6 +1683,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
},
Expand Down
Binary file modified tests/snapshots/start-p.js.snap
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/snapshots/start-ps.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ Generated by [AVA](https://ava.li).
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down Expand Up @@ -1156,6 +1157,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
},
Expand Down Expand Up @@ -1730,6 +1732,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
},
Expand Down
Binary file modified tests/snapshots/start-ps.js.snap
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/snapshots/start-s.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ Generated by [AVA](https://ava.li).
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down Expand Up @@ -1116,6 +1117,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
watchOptions: {
Expand Down
Binary file modified tests/snapshots/start-s.js.snap
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/snapshots/start.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ Generated by [AVA](https://ava.li).
mainFields: [
'esnext:browser',
'jsnext:browser',
'module-browser',
'browser',
'esnext',
'jsnext',
Expand Down Expand Up @@ -1116,6 +1117,7 @@ Generated by [AVA](https://ava.li).
'string',
'string',
'string',
'string',
],
},
watchOptions: {
Expand Down
Binary file modified tests/snapshots/start.js.snap
Binary file not shown.
0