-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow parallel type change bundles to be reused by async siblings #9504
Changes from 2 commits
43b5d52
900aaab
84f9c9d
f92d276
0bf6b0e
71a5bb7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -619,29 +619,19 @@ describe('css modules', () => { | |
}, | ||
{ | ||
type: 'js', | ||
assets: [ | ||
'page1.js', | ||
'index.module.css', | ||
'a.module.css', | ||
'b.module.css', | ||
], | ||
assets: ['page1.js'], | ||
}, | ||
{ | ||
type: 'js', | ||
assets: [ | ||
'page2.js', | ||
'index.module.css', | ||
'a.module.css', | ||
'b.module.css', | ||
], | ||
assets: ['page2.js'], | ||
}, | ||
{ | ||
type: 'css', | ||
assets: ['a.module.css', 'b.module.css'], | ||
assets: ['a.module.css', 'b.module.css', 'index.module.css'], | ||
}, | ||
{ | ||
type: 'css', | ||
assets: ['index.module.css'], | ||
type: 'js', | ||
assets: ['a.module.css', 'b.module.css', 'index.module.css'], | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these changes are due to turning on |
||
]); | ||
}); | ||
|
@@ -745,7 +735,7 @@ describe('css modules', () => { | |
assert(res[0][1].includes('container') && res[0][1].includes('expand')); | ||
}); | ||
|
||
it('should allow css modules to be shared between targets', async function () { | ||
it('should duplicate css modules between targets', async function () { | ||
let b = await bundle([ | ||
path.join(__dirname, '/integration/css-module-self-references/a'), | ||
path.join(__dirname, '/integration/css-module-self-references/b'), | ||
|
@@ -760,6 +750,14 @@ describe('css modules', () => { | |
name: 'main.css', | ||
assets: ['bar.module.css'], | ||
}, | ||
{ | ||
name: 'module.css', | ||
assets: ['bar.module.css'], | ||
}, | ||
{ | ||
name: 'module.css', | ||
assets: ['bar.module.css'], | ||
}, | ||
{ | ||
name: 'main.js', | ||
assets: ['index.js', 'bar.module.css'], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,19 +77,12 @@ describe('css', () => { | |
{ | ||
name: 'entry.js', | ||
type: 'js', | ||
assets: [ | ||
'bundle-url.js', | ||
'cacheLoader.js', | ||
'css-loader.js', | ||
'entry.js', | ||
'js-loader.js', | ||
], | ||
assets: ['bundle-url.js', 'cacheLoader.js', 'entry.js', 'js-loader.js'], | ||
}, | ||
{ | ||
type: 'js', | ||
assets: ['esmodule-helpers.js', 'index.js'], | ||
}, | ||
{name: 'Foo.css', type: 'css', assets: ['foo.css']}, | ||
{name: 'entry.css', type: 'css', assets: ['foo.css', 'main.css']}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this was actually a similar case to the one I originally described in the description. foo.css doesn't need to be duplicated because it's already loaded in a parallel bundle |
||
]); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2242,39 +2242,39 @@ describe('html', function () { | |
|
||
assertBundles(b, [ | ||
{ | ||
name: 'a.html', | ||
type: 'html', | ||
type: 'js', | ||
assets: ['a.html'], | ||
}, | ||
{ | ||
name: 'b.html', | ||
type: 'html', | ||
type: 'js', | ||
assets: ['b.html'], | ||
}, | ||
{ | ||
name: 'c.html', | ||
type: 'html', | ||
type: 'js', | ||
assets: ['c.html'], | ||
}, | ||
{ | ||
type: 'js', | ||
assets: ['a.html', 'shared.js'], | ||
name: 'a.html', | ||
type: 'html', | ||
assets: ['a.html'], | ||
}, | ||
{ | ||
type: 'js', | ||
assets: ['b.html', 'shared.js'], | ||
name: 'b.html', | ||
type: 'html', | ||
assets: ['b.html'], | ||
}, | ||
{ | ||
type: 'js', | ||
assets: ['c.html', 'shared.js'], | ||
name: 'c.html', | ||
type: 'html', | ||
assets: ['c.html'], | ||
}, | ||
{ | ||
type: 'css', | ||
assets: ['other.css'], | ||
assets: ['other.css', 'shared.css'], | ||
}, | ||
{ | ||
type: 'css', | ||
assets: ['shared.css'], | ||
type: 'js', | ||
assets: ['shared.js'], | ||
}, | ||
]); | ||
|
||
|
@@ -2493,6 +2493,14 @@ describe('html', function () { | |
type: 'css', | ||
assets: ['a.module.css'], | ||
}, | ||
{ | ||
type: 'css', | ||
assets: ['a.module.css'], | ||
}, | ||
{ | ||
type: 'css', | ||
assets: ['a.module.css'], | ||
}, | ||
{ | ||
type: 'html', | ||
assets: ['searchfield.html'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. above changes are also due to "minBundleSize" |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"@parcel/bundler-default": { | ||
"minBundleSize": 0 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"@parcel/bundler-default": { | ||
"minBundleSize": 0 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"@parcel/bundler-default": { | ||
"minBundleSize": 0 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,6 +255,10 @@ describe('monorepos', function () { | |
name: 'pkg-b.cjs.css', | ||
assets: ['index.module.css'], | ||
}, | ||
{ | ||
name: 'pkg-b.module.css', | ||
assets: ['index.module.css'], | ||
}, | ||
]); | ||
|
||
let contents = await outputFS.readFile( | ||
|
@@ -300,7 +304,7 @@ describe('monorepos', function () { | |
), | ||
'utf8', | ||
); | ||
assert(contents.includes('import "./pkg-b.cjs.css"')); | ||
assert(contents.includes('import "./pkg-b.module.css"')); | ||
}); | ||
|
||
it('should build using root targets with a glob pointing at files inside packages and cwd at project root', async function () { | ||
|
@@ -531,6 +535,10 @@ describe('monorepos', function () { | |
name: 'pkg-b.cjs.css', | ||
assets: ['index.module.css'], | ||
}, | ||
{ | ||
name: 'pkg-b.module.css', | ||
assets: ['index.module.css'], | ||
}, | ||
]); | ||
|
||
let contents = await outputFS.readFile( | ||
|
@@ -576,7 +584,7 @@ describe('monorepos', function () { | |
), | ||
'utf8', | ||
); | ||
assert(contents.includes('import "./pkg-b.cjs.css"')); | ||
assert(contents.includes('import "./pkg-b.module.css"')); | ||
}); | ||
|
||
it('should watch glob entries and build new packages that are added', async function () { | ||
|
@@ -634,6 +642,10 @@ describe('monorepos', function () { | |
name: 'pkg-b.cjs.css', | ||
assets: ['index.module.css'], | ||
}, | ||
{ | ||
name: 'pkg-b.module.css', | ||
assets: ['index.module.css'], | ||
}, | ||
]); | ||
}); | ||
|
||
|
@@ -788,6 +800,10 @@ describe('monorepos', function () { | |
name: 'pkg-a.cjs.css', | ||
assets: ['index.module.css'], | ||
}, | ||
{ | ||
name: 'pkg-a.module.css', | ||
assets: ['index.module.css'], | ||
}, | ||
{ | ||
name: 'pkg-b.cjs.js', | ||
assets: ['index.js', 'index.module.css'], | ||
|
@@ -800,6 +816,10 @@ describe('monorepos', function () { | |
name: 'pkg-b.cjs.css', | ||
assets: ['index.module.css'], | ||
}, | ||
{ | ||
name: 'pkg-b.module.css', | ||
assets: ['index.module.css'], | ||
}, | ||
]); | ||
|
||
let contents = await outputFS.readFile( | ||
|
@@ -820,7 +840,7 @@ describe('monorepos', function () { | |
'utf8', | ||
); | ||
assert(contents.includes('export {')); | ||
assert(contents.includes('import "./pkg-a.cjs.css"')); | ||
assert(contents.includes('import "./pkg-a.module.css"')); | ||
|
||
contents = await outputFS.readFile( | ||
path.join( | ||
|
@@ -856,7 +876,7 @@ describe('monorepos', function () { | |
), | ||
'utf8', | ||
); | ||
assert(contents.includes('import "./pkg-b.cjs.css"')); | ||
assert(contents.includes('import "./pkg-b.module.css"')); | ||
}); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changes in this file are due to css bundles no longer being reused between different targets, so there is now both a CJS and ESM version |
||
it('should search for .parcelrc at cwd in monorepos', async () => { | ||
|
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.
fixes a separate bug that was exposed by these changes: resolving a dependency to an asset should try to resolve to an asset of the same type as the bundle it's in. without this, there was a crash in the JS packager that resolved an dependency to a CSS asset.