-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
fix(optimize-deps): don't externalize JS files imported with asset extensions #16242
Merged
sapphi-red
merged 6 commits into
vitejs:main
from
proc07:fix/externalize-the-asset-js-file-type-but-enter-vite-dep-pre-bundle
May 30, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4b78d33
fix: externalize the asset js file type, but enter vite:dep-pre-bundle
proc07 cf0e3f1
test: externalize the asset js file type (#16116)
proc07 4fea3eb
fix: del log
proc07 7b37ca1
fix: save lock package
proc07 5f16c7d
fix: set private
proc07 cd02ca3
fix: del config commonjsOptions
proc07 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
playground/optimize-deps/dep-cjs-external-package-omit-js-suffix/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const { okay } = require('./test.okay') | ||
const { scss } = require('./test.scss') | ||
const { astro } = require('./test.astro') | ||
const { tsx } = require('./test.tsx') | ||
|
||
module.exports = { okay, scss, astro, tsx } |
6 changes: 6 additions & 0 deletions
6
playground/optimize-deps/dep-cjs-external-package-omit-js-suffix/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "@vitejs/test-dep-cjs-external-package-omit-js-suffix", | ||
"private": true, | ||
"version": "0.0.0", | ||
"main": "index.js" | ||
} |
5 changes: 5 additions & 0 deletions
5
playground/optimize-deps/dep-cjs-external-package-omit-js-suffix/test.astro.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function astro() { | ||
return 'astro' | ||
} | ||
|
||
module.exports = { astro } |
5 changes: 5 additions & 0 deletions
5
playground/optimize-deps/dep-cjs-external-package-omit-js-suffix/test.okay.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function okay() { | ||
return 'okay' | ||
} | ||
|
||
module.exports = { okay } |
5 changes: 5 additions & 0 deletions
5
playground/optimize-deps/dep-cjs-external-package-omit-js-suffix/test.scss.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function scss() { | ||
return 'scss' | ||
} | ||
|
||
module.exports = { scss } |
5 changes: 5 additions & 0 deletions
5
playground/optimize-deps/dep-cjs-external-package-omit-js-suffix/test.tsx.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
function tsx() { | ||
return 'tsx' | ||
} | ||
|
||
module.exports = { tsx } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there a reason we only check this in
require-call
only? Wouldn't this help for imports too?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 think the reason is because we don't support
import
without extensions in dependencies. But I've noticed that there's a case likeimport 'normalize.css'
.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.
Ah right, you have to specify the full path with imports. Let's try this then.