1
Angular2で非常に簡単なアプリケーションを1つのjsファイルにバンドルしたいと思います。ウェブパッケージでAngular2アプリをパッケージ化。バンドルファイルが機能しません。セレクタ "my-app"が要素と一致しません
私は、次のしているディレクトリ構造は:
/-client
|
\-app
- main.ts
- app.module.ts
- app.component.ts
- app.component.spec.ts
-webpack.config.js
- ....
設定ファイルには、次のようになります。
var webpack = require('webpack');
module.exports = {
entry: {
'app': './app/main.ts'
},
output: {
filename: 'app.js'
},
resolve: {
extensions: ['.ts', '.js']
},
module: {
loaders: [
{
test: /\.ts$/,
loaders: ['awesome-typescript-loader', 'angular2-template-loader']
}
]
}
};
ビルド仕上げに成功し、app.js(1.95メガバイト)生成しますが、私は、ファイルをインポートするときウェブページエラーが発生しました:
app.js:26914Error: The selector "my-app" did not match any elements
at DomRenderer.selectRootElement (http://localhost:3000/app.js:18516:23)
at DebugDomRenderer.selectRootElement (http://localhost:3000/app.js:37373:39)
at selectOrCreateRenderHostElement (http://localhost:3000/app.js:10870:32)
at DebugAppView.View_AppComponent_Host0.createInternal (/AppModule/AppComponent/host.ngfactory.js:13:16)
at DebugAppView.AppView.createHostView (http://localhost:3000/app.js:38774:21)
at DebugAppView.createHostView (http://localhost:3000/app.js:39034:52)
at ComponentFactory.create (http://localhost:3000/app.js:17625:25)
at ApplicationRef_.bootstrap (http://localhost:3000/app.js:16050:40)
at http://localhost:3000/app.js:15959:89
at Array.forEach (native)
zone.js:388 Unhandled Promise rejection: Error in :0:0 caused by: The selector "my-app" did not match any elements ; Zone: <root> ; Task: Promise.then ; Value:
私は間違っていると思いますか?
おかげ
メートル