我正在尝试将项目与 Webpack 捆绑在一起,但我收到一个错误:“找不到模块 './stylesheet/css/build.css'”我正在使用 webpack 1.14.0 和 yarn 0.17.10。 webpack 打印屏幕
请给我一些建议,我应该如何使用 require() 来获得结果。
感谢您的帮助!
webpack.dev.js
var config = {
cache: true,
devtool: 'source-map',
entry: {
polyfills: './src/polyfills',
vendor: './src/vendor',
main: './src/main'
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].bundle.js',
sourceMapFilename: '[name].map',
chunkFilename: '[id].chunk.js'
},
module: {
loaders: [
{ test: /\.ts$/, loader: 'awesome-typescript-loader' },
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.html/, loader: 'raw-loader' },
{ test: /\.css$/, loader: 'to-string-loader!css-loader' },
{ test: /\.css$/, loader: ExtractTextPlugin.extract('css?minimize')}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({ name: ['polyfills', 'vendor', 'main'].reverse(), minChunks: Infinity }),
new ExtractTextPlugin('/src/stylesheet/css/zio.css')
],
resolve: {
extensions: ['', '.ts', '.js', '.json'],
modulesDirectories: ['node_modules', 'src']
}
};
main.ts
require("./stylesheet/css/build.css");
@NgModule({
declarations: [
App,
Main,
Auth,
AppHeader
],
providers,
imports: [
BrowserModule,
HttpModule,
FormsModule,
routes
],
bootstrap: [App]
})
export class AppModule {}
附加信息 - 项目结构