【发布时间】:2018-09-04 21:11:22
【问题描述】:
我收到以下错误。
ERROR in [at-loader] ./ClientApp/boot.ts:7:23
TS1109: Expression expected.
ERROR in [at-loader] ./ClientApp/boot.ts:7:29
TS1134: Variable declaration expected.
ERROR in [at-loader] ./ClientApp/boot.ts:8:25
TS1109: Expression expected.
ERROR in [at-loader] ./ClientApp/boot.ts:8:31
TS1134: Variable declaration expected.
我有以下 boot.ts 文件。
import './css/site.css';
import 'bootstrap';
import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);
const Counter = () => import('./components/counter/counter');
const FetchData = () => import('./components/fetchdata/fetchdata');
const routes = [
{ path: '/', component: require('./components/home/home.vue.html') },
{ path: '/counter', component: Counter },
{ path: '/fetchdata', component: FetchData }
];
new Vue({
el: '#app-root',
router: new VueRouter({ mode: 'history', routes: routes }),
render: h => h(require('./components/app/app.vue.html'))
});
我的 tsconfig.json 文件如下所示。
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"target": "es5",
"sourceMap": true,
"skipDefaultLibCheck": true,
"strict": true,
"importHelpers": true,
"lib": [
"es5",
"es2015.promise"
],
"types": ["webpack-env"]
},
"exclude": [
"bin",
"node_modules"
]
}
我想实现以下目标。我正在使用 webpack。所以如果需要,我可以在这里发帖。
【问题讨论】:
-
您使用的是什么版本的 Typescript? 2.4 之前不支持动态导入语法。
-
对不起。我对此很陌生。但我的 package.json 看起来像这样。 “打字稿”:“^2.2.1”,
-
如果你运行
npm list typescript,输出是什么? -
嘿,伙计。我试过 npm update --save。现在是新错误。 TS2304:找不到名称“节点”。
-
你的命令就会显示出来。 `-- typescript@2.7.2
标签: typescript webpack vue.js