mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
fix webignore patterns for appinsights
also, web: look for minified entrypoints as well Closes: #140158
This commit is contained in:
parent
35c70dc0a2
commit
a9acf06479
|
@ -32,3 +32,7 @@ xterm-addon-webgl/out/**
|
|||
|
||||
# This makes sure the model is included in the package
|
||||
!@vscode/vscode-languagedetection/model/**
|
||||
|
||||
@microsoft/applicationinsights*/**
|
||||
@microsoft/dynamicproto-js/**
|
||||
!@microsoft/applicationinsights-web/dist/applicationinsights-web.min.js
|
|
@ -323,10 +323,17 @@ function acquireWebNodePaths() {
|
|||
}
|
||||
// Remove any starting path information so it's all relative info
|
||||
if (entryPoint.startsWith('./')) {
|
||||
entryPoint = entryPoint.substr(2);
|
||||
entryPoint = entryPoint.substring(2);
|
||||
}
|
||||
else if (entryPoint.startsWith('/')) {
|
||||
entryPoint = entryPoint.substr(1);
|
||||
entryPoint = entryPoint.substring(1);
|
||||
}
|
||||
// Search for a minified entrypoint as well
|
||||
if (/(?<!\.min)\.js$/i.test(entryPoint)) {
|
||||
const minEntryPoint = entryPoint.replace(/\.js$/i, '.min.js');
|
||||
if (fs.existsSync(path.join(root, 'node_modules', key, minEntryPoint))) {
|
||||
entryPoint = minEntryPoint;
|
||||
}
|
||||
}
|
||||
nodePaths[key] = entryPoint;
|
||||
}
|
||||
|
|
|
@ -384,23 +384,37 @@ export function acquireWebNodePaths() {
|
|||
for (const key of Object.keys(webPackages)) {
|
||||
const packageJSON = path.join(root, 'node_modules', key, 'package.json');
|
||||
const packageData = JSON.parse(fs.readFileSync(packageJSON, 'utf8'));
|
||||
let entryPoint = packageData.browser ?? packageData.main;
|
||||
let entryPoint: string = packageData.browser ?? packageData.main;
|
||||
|
||||
// On rare cases a package doesn't have an entrypoint so we assume it has a dist folder with a min.js
|
||||
if (!entryPoint) {
|
||||
// TODO @lramos15 remove this when jschardet adds an entrypoint so we can warn on all packages w/out entrypoint
|
||||
if (key !== 'jschardet') {
|
||||
console.warn(`No entry point for ${key} assuming dist/${key}.min.js`);
|
||||
}
|
||||
|
||||
entryPoint = `dist/${key}.min.js`;
|
||||
}
|
||||
|
||||
// Remove any starting path information so it's all relative info
|
||||
if (entryPoint.startsWith('./')) {
|
||||
entryPoint = entryPoint.substr(2);
|
||||
entryPoint = entryPoint.substring(2);
|
||||
} else if (entryPoint.startsWith('/')) {
|
||||
entryPoint = entryPoint.substr(1);
|
||||
entryPoint = entryPoint.substring(1);
|
||||
}
|
||||
|
||||
// Search for a minified entrypoint as well
|
||||
if (/(?<!\.min)\.js$/i.test(entryPoint)) {
|
||||
const minEntryPoint = entryPoint.replace(/\.js$/i, '.min.js');
|
||||
|
||||
if (fs.existsSync(path.join(root, 'node_modules', key, minEntryPoint))) {
|
||||
entryPoint = minEntryPoint;
|
||||
}
|
||||
}
|
||||
|
||||
nodePaths[key] = entryPoint;
|
||||
}
|
||||
|
||||
return nodePaths;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue