首页 / 浏览问题 / WebGIS / 问题详情
supermap vue项目ie兼容
1EXP 2020年06月16日
问题:ie11中报模块依赖语法错误

./node_modules/_@supermap_iclient-common@10.0.1@@supermap/iclient-common/commontypes/geometry/Collection.js

"SyntaxError: 语法错误

脚手架:

@vue/cli-service": "^3.9.0"

   已配置:transpileDependencies: [

        '_@supermap/iclient-common',

        '_@supermap/iclient-ol',

        'elasticsearch'

      ],

babel-polyfill es6-promise依赖已引入

1个回答

您好,您确定下您的配置方式     

module: {

    rules: [

      {

        test: /\.vue$/,

        loader: 'vue-loader',

        options: vueLoaderConfig

      },

      {

        test: /\.js$/,

        loader: 'babel-loader',

        include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client'),

       resolve( "node_modules/@supermap/iclient-common"),

       resolve( "node_modules/@supermap/iclient-leaflet"),

       resolve( "node_modules/elasticsearch")],

        options: {

          presets: ['env']

         }

      },
3,357EXP 2020年06月16日
我用的超图依赖是@supermap/iclient-ol": "^10.0.1",Vue cli是"@vue/cli-service": "^3.9.0",上面的配置不符合我的配置格式;

我的是在vue.config.js配置:

module.exports = {

    publicPath: './',

    outputDir: 'dist',

    assetsDir: 'static',

    productionSourceMap: false,

    transpileDependencies: [

        '_@supermap/iclient-common',

        '_@supermap/iclient-ol',

        'elasticsearch'

      ],

    devServer: {

        port: 7000,

    //     proxy: {

    //         '/api':{

    //             target:'http://jsonplaceholder.typicode.com',

    //             changeOrigin:true,

    //             pathRewrite:{

    //                 '/api':''

    //             }

    //         }

    //     }

    },

    chainWebpack(config) {

        // set svg-sprite-loader

        config.module

        .rule('svg')

        .exclude.add(resolve('src/icons'))

        .end()

        config.module

        .rule('icons')

        .test(/\.svg$/)

        .include.add(resolve('src/icons'))

        .end()

        .use('svg-sprite-loader')

        .loader('svg-sprite-loader')

        .options({

            symbolId: 'icon-[name]'

        })

        .end()

    }

}
只是给你一个类似的例子,您可以再webpack官网查询如何配置babel-loader
...