Reduce number of files copied for TS web build
This commit is contained in:
parent
33659eda9f
commit
d43491b79d
1 changed files with 16 additions and 11 deletions
|
@ -22,20 +22,25 @@ module.exports = withBrowserDefaults({
|
||||||
new CopyPlugin({
|
new CopyPlugin({
|
||||||
patterns: [
|
patterns: [
|
||||||
{
|
{
|
||||||
from: 'node_modules/typescript-web-server',
|
from: 'node_modules/typescript-web-server/*.d.ts',
|
||||||
to: 'typescript-web',
|
to: 'typescript-web/',
|
||||||
transform: (content, absoluteFrom) => {
|
flatten: true
|
||||||
if (absoluteFrom.endsWith('tsserver.js')) {
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
// @ts-ignore
|
||||||
|
new CopyPlugin({
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
from: 'node_modules/typescript-web-server/tsserver.js',
|
||||||
|
to: 'typescript-web/tsserver.web.js',
|
||||||
|
transform: (content) => {
|
||||||
return Terser.minify(content.toString()).code;
|
return Terser.minify(content.toString()).code;
|
||||||
}
|
|
||||||
return content;
|
|
||||||
},
|
},
|
||||||
transformPath: (targetPath) => {
|
transformPath: (targetPath) => {
|
||||||
if (targetPath.endsWith('tsserver.js')) {
|
|
||||||
return targetPath.replace('tsserver.js', 'tsserver.web.js');
|
return targetPath.replace('tsserver.js', 'tsserver.web.js');
|
||||||
}
|
}
|
||||||
return targetPath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in a new issue