В приложении реагирования IE 11 при попытке импорта excel js, как показано ниже, ядро js выдает ошибку «Несовместимый приемник, требуется RegExp» (SCRIPT5022: исключение выброшено и не зафиксировано в журнале). Хотя он работает правильно в chrome и edge.
Excel js импорт:
import * as Excel from 'exceljs';
Я также пытался импортировать его как
import * as ExcelJS from 'exceljs';
import * as Excel from "exceljs/dist/exceljs.min.js";
import Excel from "exceljs/dist/es5/exceljs.browser";
Все это не помогло.
Ниже находится файл .babelr c:
/* Util functions */
const withoutPlugin = pluginName => config => {
const newPlugins = config.plugins.filter(([ pluginId ]) => pluginId !== pluginName);
return Object.assign({}, config, { plugins: newPlugins });
};
const preserveTestingAttributes = withoutPlugin('./src/babelPluginRemoveAttributes');
/* Plugins */
const commonPlugins = [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-runtime",
];
const stripAttributesPlugin = [
"./src/babelPluginRemoveAttributes",
{
attributes: [
"data-at-id",
"data-copy-id",
]
}
];
const requireIgnoreCssPlugin = [
"babel-plugin-transform-require-ignore",
{
extensions: [
".css",
]
}
];
const reactDevelopmentPlugins = [
"react-hot-loader/babel",
[
"inline-react-svg",
{
"svgo": {
"plugins": [
{ "cleanupIDs": false },
]
}
}
],
["inline-import-data-uri", {
"extensions": [
".png",
]
}]
];
const reactProductionPlugins = [
[
"inline-react-svg",
{
"svgo": {
"plugins": [
{ "cleanupIDs": false },
]
}
}
],
[
"transform-react-remove-prop-types",
{
ignoreFilenames: [
"node_modules",
]
}
]
];
/* Presets */
const nodeProductionPreset = [
"@babel/preset-env",
{
targets: {
node: "8.11.3",
}
}
];
const browserProductionPreset = [
"@babel/preset-env",
{
targets: '>1%, ie 11',
modules: false,
useBuiltIns: false,
}
];
/* Environment configs */
const client_production = {
presets: [ browserProductionPreset ],
plugins: [
...reactProductionPlugins,
],
};
const server_production = {
ignore: [
"**/*.test.js",
"**/*.test.jsx",
"**/test",
"**/__mocks__",
"**/babelPluginRemoveAttributes.js",
"**/testUtils.js"
],
plugins: [
[
"inline-react-svg",
{
"svgo": {
"plugins": [
{ "cleanupIDs": false },
]
}
}
],
[
"file-loader",
{
"name": "[hash].[ext]",
"extensions": ["png"],
"publicPath": "/__public",
"outputPath": "/dist/public",
"context": "/src",
"limit": 0
}
],
requireIgnoreCssPlugin,
],
presets: [ nodeProductionPreset ],
};
/* Exported Config */
module.exports = {
plugins: [ ...commonPlugins ],
presets: [ "@babel/preset-react" ],
env: {
'client:production': client_production,
'client:release-candidate': preserveTestingAttributes(client_production),
'server:production': server_production,
'server:release-candidate': preserveTestingAttributes(server_production),
development: {
plugins: [
...reactDevelopmentPlugins,
'@babel/plugin-proposal-optional-chaining',
'@babel/plugin-proposal-nullish-coalescing-operator'
],
presets: [
"@babel/preset-env"
]
},
test: {
presets: [ nodeProductionPreset ]
}
},
sourceType: "unambiguous",
}
webpack.config. js:
module: {
rules: [
{
test: /\.(js|jsx)$/,
include: path.resolve(__dirname, 'src'),
resolve: {
extensions: ['.js', '.jsx'],
},
use: { loader: 'babel-loader' },
},
]
}
Любая помощь было бы заметно, спасибо :)