-
Notifications
You must be signed in to change notification settings - Fork 0
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
Updates for sourcemaps, esModules #46
Open
amcclain
wants to merge
2
commits into
develop
Choose a base branch
from
externalSourceMaps
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -388,7 +388,7 @@ async function configureWebpack(env) { | |
// Add JSX to support imports from .jsx source w/o needing to add the extension. | ||
// Include "*" to continue supporting other imports that *do* specify an extension | ||
// within the import statement (i.e. `import './foo.png'`). Yes, it's confusing. | ||
extensions: ['*', '.js', '.ts', '.jsx', '.tsx', '.json'] | ||
extensions: ['.*', '.js', '.ts', '.jsx', '.tsx', '.json'] | ||
}, | ||
|
||
// Ensure Webpack can find loaders installed both within the top-level node_modules dir for | ||
|
@@ -422,7 +422,13 @@ async function configureWebpack(env) { | |
test: /\.mjs$/, | ||
type: 'javascript/auto' | ||
}, | ||
|
||
//------------------------ | ||
// Handle non-esModules from within esModules without specifying their file extension | ||
//------------------------ | ||
{ | ||
test: /\.m?js$/, | ||
resolve: {fullySpecified: false} | ||
}, | ||
//------------------------ | ||
// Image processing | ||
// Encodes `url()` references directly when small enough. | ||
|
@@ -601,6 +607,11 @@ async function configureWebpack(env) { | |
options: { | ||
name: 'static/media/[name].[hash:8].[ext]' | ||
} | ||
}, | ||
{ | ||
test: /\.js$/, | ||
enforce: "pre", | ||
use: ["source-map-loader"], | ||
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. How will we hit this new rule, given the Did you see any effect from it? |
||
} | ||
] | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1666,6 +1666,11 @@ | |
resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d" | ||
integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== | ||
|
||
abab@^2.0.6: | ||
version "2.0.6" | ||
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" | ||
integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== | ||
|
||
accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: | ||
version "1.3.8" | ||
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" | ||
|
@@ -3329,6 +3334,13 @@ [email protected]: | |
dependencies: | ||
safer-buffer ">= 2.1.2 < 3" | ||
|
||
iconv-lite@^0.6.3: | ||
version "0.6.3" | ||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" | ||
integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== | ||
dependencies: | ||
safer-buffer ">= 2.1.2 < 3.0.0" | ||
|
||
icss-utils@^5.0.0, icss-utils@^5.1.0: | ||
version "5.1.0" | ||
resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae" | ||
|
@@ -4699,7 +4711,7 @@ safe-regex-test@^1.0.0: | |
get-intrinsic "^1.1.3" | ||
is-regex "^1.1.4" | ||
|
||
"safer-buffer@>= 2.1.2 < 3": | ||
"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": | ||
version "2.1.2" | ||
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" | ||
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== | ||
|
@@ -4898,6 +4910,15 @@ sockjs@^0.3.24: | |
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" | ||
integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== | ||
|
||
source-map-loader@^4.0.1: | ||
version "4.0.1" | ||
resolved "https://registry.yarnpkg.com/source-map-loader/-/source-map-loader-4.0.1.tgz#72f00d05f5d1f90f80974eda781cbd7107c125f2" | ||
integrity sha512-oqXpzDIByKONVY8g1NUPOTQhe0UTU5bWUl32GSkqK2LjJj0HmwTMVKxcUip0RgAYhY1mqgOxjbQM48a0mmeNfA== | ||
dependencies: | ||
abab "^2.0.6" | ||
iconv-lite "^0.6.3" | ||
source-map-js "^1.0.2" | ||
|
||
source-map-support@~0.5.20: | ||
version "0.5.21" | ||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" | ||
|
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.
Reading webpack docs on rules, these are nested under a
oneOf
block, and so I would expect that only the first matching rule would be applied. I believe this means that this rule would never get hit for.mjs
files given the rule above. Do we want to add the same{fullySpecified: false}
to the first rule in the list to cover mjs files?Also, to the bigger point, I'm not sure how to interpret the comment "Handle non-esModules from within esModules without specifying their file extension" - can you help remind me what this is changing / fixing?
Our top-level
resolve
block has the list of extensions.I see in the docs that this
fullySpecified
option is (weirdly?) called out only within therules
section - https://webpack.js.org/configuration/module/#resolvefullyspecified - but then I don't see it within the top-level docs for resolve - https://webpack.js.org/configuration/resolve/#resolveI don't really know what to make of that, and I'm struggling to understand what the docs are saying here. Don't we get the behavior from the top-level block where any imports will match files with extensions in the list? What does this new directive do differently? What issue are we hitting with dev-utils that this overcomes?