webpack modifications include babel for IE11
This commit is contained in:
parent
98148a63d4
commit
81d89d830e
|
@ -2,43 +2,52 @@
|
|||
|
||||
const gulp = require('gulp');
|
||||
const build = require('@microsoft/sp-build-web');
|
||||
const path = require('path');
|
||||
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
|
||||
|
||||
let needIESupport = true;
|
||||
if(!!process.argv && process.argv.length >0) {
|
||||
needIESupport = process.argv.findIndex(item => '--noie11' === item.toLowerCase()) !=-1 ;
|
||||
if (!!process.argv && process.argv.length > 0) {
|
||||
needIESupport = process.argv.findIndex(item => '--noie11' === item.toLowerCase()) === -1;
|
||||
}
|
||||
|
||||
if (needIESupport) {
|
||||
const ie11BabeLoader = {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
"ie": "11"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if(needIESupport){
|
||||
process.stdout.write(`Using babel-loader to support IE11 \n`);
|
||||
build.configureWebpack.mergeConfig({
|
||||
additionalConfiguration: (generatedConfiguration) => {
|
||||
generatedConfiguration.module.rules.push({
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules\/(?!(rss-paser))/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: [
|
||||
["@babel/preset-env",
|
||||
{
|
||||
targets: {
|
||||
"ie": "11"
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
/*
|
||||
This selector increase the webpack time 5 times then without
|
||||
exclude: [/node_modules\/(?!(rss-parser))/],
|
||||
*/
|
||||
include: [
|
||||
path.resolve(__dirname, "node_modules/rss-parser"),
|
||||
],
|
||||
use: [ie11BabeLoader]
|
||||
});
|
||||
|
||||
|
||||
return generatedConfiguration;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
process.stdout.write(`No IE11 Support webpack will be 5 times faster \n`);
|
||||
process.stdout.write(`No IE11 Support is set \n`);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue