2016-08-05 4 views
0

私のアプリでwebpackを使用しようとしていますが、htmlでテンプレートを読み込もうとするとエラーが発生します。1.xとwebpackのテンプレートを使用する方法

モジュールの解析に失敗しました:C:\ Users \ユーザーファビアン\ Dropboxが\ FixMyCity \ FixMyCity \ SRC \ FixMyCity.Web \アプリケーション\設定\ settings.html予期しないトークン(1こ​​れは私が現在取得しています一つです:0)
このファイルタイプを処理するには、適切なローダーが必要な場合があります。私はhtmlのための右のローダを持っていないが、私はraw-loaderhtml-loadの両方でそれを試してみたし、それらのいずれもが私のために働いていると思います

。ここで

を使用すると、プロパティ・ローダに値を入れてheveその後あなたは、NPMからのhtml-ローダーをインストールする必要があります私の現在のwebpack.config.js

module.exports = { 
    entry: './App/app.js', 
    output: { 
     filename: './wwwroot/app-bundle.js' 
    }, 
    loaders: [ 

      { test: /\.html$/, loader: 'html' }, 
      { test: /\.css$/, loader: 'style!css' }, 
    ] 
}; 

app.js

var app = angular.module('app', ['auth0', 'angular-storage', 'angular-jwt', 'ngRoute']) 
.config(['$routeProvider', 'authProvider', 'jwtInterceptorProvider', '$httpProvider', configFunction]) 


function configFunction($routeProvider, authProvider, jwtInterceptorProvider, $httpProvider) { 
    // Configure routes for your application 
    $routeProvider 
     .when('/', { 
      controller: 'HomeCtrl', 
      template: require('./home/home.html'), 
      requiresLogin: true 
     }) 
} 
+0

あなたが '' npm'付きのhtml-loader'をinsalledたのですか? –

答えて

0

です'html-loader'。このよう

module.exports = { 
entry: './App/app.js', 
output: { 
    filename: './wwwroot/app-bundle.js' 
}, 
loaders: [ 

     { test: /\.html$/, loader: 'html-loader' }, 
     { test: /\.css$/, loader: 'style!css' }, 
]}; 
関連する問題