私の問題の解決方法を探していますが、なぜ私のCSSがロードされていないのかわかりません。 コンポーネントにhtmlとcssが必要な単純なAngluar 2アプリがあります。 webpackはバンドルを行い、htmlファイルとjsファイルのbundle.jsを作成します。ただし、バンドル内のcssファイルはロードされません。代わりに、私の実際のCSSのそれは置く:ここ未処理のCSSがバンドルにロードされていません.js角度2のアプリケーション
function(module, exports) {
module.exports = "// style-loader: Adds some css to the DOM by adding a <style> tag\n\n// load the styles\nvar content = require(\"!!./../../node_modules/css-loader/index.js!./print.css\");\nif(typeof content === 'string') content = [[module.id, content, '']];\n// add the styles to the DOM\nvar update = require(\"!./../../node_modules/style-loader/addStyles.js\")(content, {});\nif(content.locals) module.exports = content.locals;\n// Hot Module Replacement\nif(module.hot) {\n\t// When the styles change, update the <style> tags\n\tif(!content.locals) {\n\t\tmodule.hot.accept(\"!!./../../node_modules/css-loader/index.js!./print.css\", function() {\n\t\t\tvar newContent = require(\"!!./../../node_modules/css-loader/index.js!./print.css\");\n\t\t\tif(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n\t\t\tupdate(newContent);\n\t\t});\n\t}\n\t// When the module is disposed, remove the <style> tags\n\tmodule.hot.dispose(function() { update(); });\n}"/***/ }
は、私が使用しています私のwebpack.configファイルのCSSの部分に関連している:
{
test: /\.css$/,
loader: 'raw'
},
{
test: /\.css$/,
loader: 'style!css'
},
{
test:/\.gif|png/, loader: "file-loader"
},
{
test: /\.html$/,
loader: 'raw'
}
resolve: {
extensions: ['', '.ts', '.js', '.json','.css', '.html']
}
、私のコンポーネントで、私は単純にHTMLを必要としていますし、 CSSファイル。
@Component({
selector: 'my-app',
styles: [require('./my.css')],
template: require('./my.html')
})
bundle.jsに入れたテキストは、CSSファイルを見つけることができなかったローダーのようなものですが、彼らはロードされている私のhtmlファイルと同じ相対パスです。
問題が発生する可能性があることは誰か知りませんか?
私は何かアドバイスをいただければ幸いです。