【发布时间】:2020-02-02 07:17:00
【问题描述】:
我正在尝试使用通常的 import Vuetify from "vuetify/lib" 引用 vuetify/lib,但是当我这样做时,应用程序在 IE11 中使用 SCRIPT1003: Expected ':' 阻塞。
如果我更改对 import Vuetify from "vuetify" 的引用 - 没有 /lib 部分 - 它不会引发错误。
请注意,我实际上还没有在任何地方使用 vuetify。我没有单个 Vuetify 组件或调用;我只是添加库。
现在我表面上已经被 IE11 包含并愉快地解析了 vuetify,我想使用一些组件。如果我将 任何 vuetify 组件放入我的模板中,IE11 会抛出 Script1002: Syntax Error 消息。
有没有人建议让它真正起作用?
Index.cshtml
<v-app>
<div id="reportApp"></div>
</v-app>
入口点
// polyfills
import "core-js/stable";
import "regenerator-runtime/runtime";
import Vue from "vue"
import "@mdi/font/css/materialdesignicons.css"
import reportFilter from "./reportFilter.vue"
const options = {
el: "#reportApp",
render: h => h(reportFilter)
};
export default new Vue(options);
reportFilter.vue
<template>
<div>
<!-- this will throw a syntax error -->
<v-progress-circular indeterminate color="primary"
></v-progress-circular>
</div>
</template>
<script>
import axios from 'axios'
export default {
name: 'report-filter',
data: function(){
return {
dataTypeList: [
{ value: "1", text: "one" },
{ value: "2", text: "two" },
{ value: "3", text: "three" }
]
}
},
}
</script>
webpack.config.js
const path = require("path");
const fs = require("fs");
const { VueLoaderPlugin } = require("vue-loader");
const VuetifyLoaderPlugin = require("vuetify-loader/lib/plugin");
module.exports = {
entry: jsEntries, // setting jsEntries removed for clarity
mode: "development",
module: {
rules: [
// other rules for css/sass/etc removed for clarity
/*javascript*/{
test: /\.m?js$/,
exclude: [
/node_modules/,
/bower_components/
],
use: {
loader: "babel-loader",
options: {
presets: [
[
"@babel/preset-env",
{
"targets": {
"browsers": [
"last 2 versions",
"ie >= 11"
]
},
"corejs": "3",
"useBuiltIns": "entry"
}
]
]
}
}
},
/*vue*/{
test: /\.vue$/i,
use: "vue-loader"
}
]
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "./wwwroot/dist/js/"),
publicPath: "/wwwroot/dist/js/"
},
plugins: [
new VueLoaderPlugin(),
new VuetifyLoaderPlugin()
],
resolve: {
alias: {
vue: "vue/dist/vue.js"
}
}
};
【问题讨论】:
-
你消化了文档vuetifyjs.com/en/getting-started/… 吗?我不使用 Vuetify - 所以我这只是一个链接...
-
@madflow 是的,我已经尽力了,但我没有看到解决方案。
-
同样的问题发生在我身上,我用谷歌搜索了每个角落寻找答案。我也尽力了,没有用。所以,如果有一天你找到了解决方案,请回到这里粘贴答案,谢谢。
-
您的开发和生产过程中是否出现此错误?如果您尝试构建然后运行它会怎样。
-
你能分享你的 package.json
标签: asp.net-core .net-core vuetify.js asp.net-core-mvc-2.0 babel-polyfill