IE不支持VueJS-Symfony应用程序

问题描述 投票:0回答:1

如何使IE11中的VueJS-Symfony应用程序正常工作?

我正在使用Babel Encore

[已经在Stack中检查了可用的答案,但对我不起作用。另外,尝试将@babel/polyfill直接导入也不起作用的JS。

这是我的应用程序的webpack.config.js配置

const {VueLoaderPlugin} = require('vue-loader');
let Encore = require('@symfony/webpack-encore');

Encore
    .setOutputPath('public/build/')
    .setPublicPath('/build')
    .cleanupOutputBeforeBuild()
    .enableSourceMaps(!Encore.isProduction())
    .addEntry('app', './assets/js/app.js')
    // .enableVueLoader()
    .addLoader({
        test: /\.vue$/,
        loader: 'vue-loader'
    })
    .enableBuildNotifications()
    // .configureBabel(() => {}, {
    //     useBuiltIns: 'entry',
    //     corejs: 3
    // })

    .addPlugin(new VueLoaderPlugin())
    .enableSassLoader()
    .enableVersioning(Encore.isProduction())
;


module.exports = Encore.getWebpackConfig();

注意:IE浏览器现在在控制台SCRIPT1010: Expected identifier中显示错误并显示空白页。

vue.js ecmascript-6 symfony4 polyfills webpack-encore
1个回答
0
投票

通过更新配置解决的问题

const {VueLoaderPlugin} = require('vue-loader');
let Encore = require('@symfony/webpack-encore');

Encore
  .setOutputPath('public/build/')
  .setPublicPath('/build')
  .cleanupOutputBeforeBuild()
  .enableSourceMaps(!Encore.isProduction())
  .addEntry('app', './assets/js/app.js')
  .addLoader({
      test: /\.vue$/,
      loader: 'vue-loader'
  })
  .enableBuildNotifications()

  .addPlugin(new VueLoaderPlugin())
  .enableSassLoader()
  .enableVersioning(Encore.isProduction())
 .configureBabel(function(babelConfig) {
    // add additional presets
    // babelConfig.presets.push('@babel/preset-flow');

    // no plugins are added by default, but you can add some
    // babelConfig.plugins.push('styled-jsx/babel');
  }, {
    // node_modules is not processed through Babel by default
    // but you can whitelist specific modules to process
    // includeNodeModules: ['foundation-sites'],

    // or completely control the exclude rule (note that you
    // can't use both "includeNodeModules" and "exclude" at
    // the same time)
    exclude: /loadash/
  });

module.exports = Encore.getWebpackConfig();

© www.soinside.com 2019 - 2024. All rights reserved.