久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

angular.js - webpack+angular2引入awesome-typescript-loader報錯

瀏覽:137日期:2024-03-15 08:48:53

問題描述

原來用ts-loader是沒問題的,但是需要搭配angular2-template-loader,無奈換回awesome-typescript-loader,就報錯了,請大家幫忙看下,有事兒直接說就行,在線等。

ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/bindCallback.d.ts:2:15 Invalid module name in augmentation, module ’../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/bindNodeCallback.d.ts:2:15 Invalid module name in augmentation, module ’../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/combineLatest.d.ts:2:15 Invalid module name in augmentation, module ’../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/concat.d.ts:2:15 Invalid module name in augmentation, module ’../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/defer.d.ts:2:15 Invalid module name in augmentation, module ’../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/dom/ajax.d.ts:2:15 Invalid module name in augmentation, module ’../../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/dom/webSocket.d.ts:2:15 Invalid module name in augmentation, module ’../../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/empty.d.ts:2:15 Invalid module name in augmentation, module ’../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/forkJoin.d.ts:2:15 Invalid module name in augmentation, module ’../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/from.d.ts:2:15 Invalid module name in augmentation, module ’../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/fromEvent.d.ts:2:15 Invalid module name in augmentation, module ’../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/fromEventPattern.d.ts:2:15 Invalid module name in augmentation, module ’../../Observable’ cannot be found.ERROR in [default] /Users/honpery/personal_project/honpery_com/admin_rewrite/node_modules/rxjs/add/observable/fromPromise.d.ts:2:15 Invalid module name in augmentation, module ’../../Observable’ cannot be found.

下面是我的tsconfig.json文件

{ 'compilerOptions': {'target': 'es5','module': 'commonjs','moduleResolution': 'node','sourceMap': true,'experimentalDecorators': true// 'outDir': '' }, 'buildOnSave': false, 'compileOnSave': false, 'exclude': ['node_modules' ], 'awesomeTypescriptLoaderOptions': {'useWebpackText': true }}

下面是我的webpack配置文件:

/** * 開發環境webpack配置 */const path = require(’path’);module.exports = { entry: {app: ’./src/main.ts’, }, output: {path: path.join(__dirname, ’build’),filename: ’[name].bundle.js’ }, resolve: {extensions: [’’, ’.ts’, ’.js’, ’.json’] }, module: {loaders: [ {test: /.ts$/,loaders: [’awesome-typescript-loader’, ’angular2-template-loader’],exclude: /(node_modules | libs)/ }, {test: /.less$/,loader: ’less’,exclude: /(node_modules | libs)/ }, {test: /.html$/,loader: ’raw-loader’ }] }}

問題解答

回答1:

原因: awesome-typescript-loader 最新的2.x的版本,只兼容 typescript 2.x的版本(目前正式版只到1.8)。

解決辦法:方案一: 升級 typescript 到預覽版

npm i typescript@next --save-dev

方案二: 使用awesome-typescript-loader 的1.x的版本

npm i awesome-typescript-loader@1.1.1 --save-dev回答2:

已經找到解決方案,需要更新下typescript到最新版本即可。

npm install typescript@next --save-dev

參考:https://github.com/s-panferov/awesome-typescript-loader/issues/179

標簽: web
相關文章:
主站蜘蛛池模板: 屏东县| 于田县| 且末县| 景谷| 兰考县| 布尔津县| 大厂| 阳山县| 广丰县| 兴和县| 彰化市| 会同县| 介休市| 汝阳县| 曲松县| 盘山县| 耒阳市| 丰原市| 综艺| 凤台县| 神农架林区| 抚州市| 阳西县| 佛山市| 翁源县| 崇明县| 寻乌县| 南和县| 长子县| 布尔津县| 广安市| 德州市| 新沂市| 洛扎县| 武鸣县| 左权县| 浏阳市| 酉阳| 台前县| 平凉市| 清水河县|