Как исправить веб-часть для ie11 - PullRequest
0 голосов
/ 13 апреля 2020

У меня есть проблемы с моей веб-частью в sharepoint, в сети. Это приложение использует реаги + spfx + веб-часть gulp.

enter image description here

Мой gulpfile. js, я не знаю, как настроить gulpfile для веб-части.

'use strict';

// check if gulp dist was called
if (process.argv.indexOf('dist') !== -1) {
  // add ship options to command call
  process.argv.push('--ship');
}

const path = require('path');
const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');
const gulpSequence = require('gulp-sequence');
const babel = require('gulp-babel');

build.addSuppression(
  `Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`
);

// Create clean distrubution package
gulp.task('dist', gulpSequence('clean', 'bundle', 'package-solution'));
// Create clean development package
gulp.task('dev', gulpSequence('clean', 'bundle', 'package-solution'));

build.configureWebpack.mergeConfig({
  additionalConfiguration: (generatedConfiguration) => {
    generatedConfiguration.module.rules.push(
      {
        test: /\.js$/,
        use: {
          loader: "babel-loader",
          options:
          {
            presets: [["@babel/preset-env",
              {
                targets: {
                  "ie": "11"
                }
              }]]
          }
        }
      }
    );

    return generatedConfiguration;
  }
});

/**
 * Custom Framework Specific gulp tasks
 */

build.initialize(gulp);


Я импортирую polyfill и ничего не работает

import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';
import "core-js";
import "runtime";
import  "@pnp/polyfill-ie11";

import * as React from 'react';
import * as ReactDom from 'react-dom';

Мне нужно, чтобы эта веб-часть работала нормально в inte rnet исследователь, помоги мне!

...