-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
prepend-config should use magic-string instead of normal cat #19408
Comments
Hey @erwinmombay, do you have any more documentation/requirements on this?
|
Will ping tomorrow for a quick walk thru. Need to know:
|
Which gulp trigger calls the code inside single-pass. Code exported as part of tasks/index.js, but I lose track after.
Any way to test more than one JS at the time? So far the ones I build with gulp dist don't have source map issues.
feel free to ping me anytime or schedule a call |
Source Map issue summary
Walk-thru example by @danielrozenberg
Work Summary
SuggestionsCheck if reimplementing |
we'll need to look at prepend-global task too in |
For readability purposes, I recommend refactoring function wrapMainBinaries() {
const [prefix, suffix] = wrappers.mainBinary.split('<%= contents %>');
// Cache the v0 file so we can prepend it to alternative binaries.
const mainFile = 'dist/v0.js';
const bootstrapCode = fs.readFileSync('dist/v0.js', 'utf8');
jsFilesToWrap.forEach(file => {
const path = `dist/${file}.js`;
if (path === mainFile) {
fs.writeFileSync(path, `${prefix}${bootstrapCode}${suffix}`);
}
else {
const fileContent = fs.readFileSync(path).toString();
const isAmpAltstring = 'self.IS_AMP_ALT=1;';
const prependContent = `${isAmpAltstring}${prefix}${bootstrapCode}`;
fs.writeFileSync(path, `${prependContent}${fileContent}${suffix}`);
}
});
} Not making a PR for now since this code might be heavily modified to fix the current issue. |
This is a high priority issue but it hasn't been updated in awhile. @Marcial1234 Do you have any updates? |
1 similar comment
This is a high priority issue but it hasn't been updated in awhile. @Marcial1234 Do you have any updates? |
@erwinmombay Still high priority? Assigning back to you so this doesn't get forgotten. |
Just went through the steps described in #19408 (comment) and was able to step through code with the cdn and local dev cases, for single and multi pass. There have been several fixes to sourcemaps recently, so I'm marking this as resolved. |
magic-string has the ability to update the source map files so it is better than a normal cat
The text was updated successfully, but these errors were encountered: