import - Webpack does not find my css file -


i'm strugling import css file webpack. keep getting error:

error in ./index.js module not found: error: cannot resolve 'file' or 'directory' ../style/style.css in c:\developement\prja/app  @ ./index.js 11:0-29 

i tried sorts of path style.css. 'css!../style/style.css', '/style/style.css' or './style/style.css' none of them works. tried use require instead of import. keep getting same error message.

any ideas?

my index.js entry point file looks this:

import 'expose?$!expose?jquery!jquery'; import angular 'angular'; import 'bootstrap-webpack'; import '../style/style.css';  var ngmodule = angular.module('app', []); 

an webpack.config.js:

module.exports = {     context: __dirname + '/app',     entry: './index.js',     output: {         path: __dirname + '/app',         filename: 'bundle.js'     },     module: {         loaders: [             {                 test: /\.js$/,                 exclude: /node_modules/,                 loader: "babel-loader"             },             {                 test: /\.css$/,                 loader: 'style-loader!css-loader'             },             {test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/font-woff'},             {test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/octet-stream'},             {test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file'},             {test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml'}         ]     }  }; 

and file sctructure:

|   lighthouse.iml |   package.json |   webpack.config.js |    +---app |       index.html |       index.js       |                \---style         style.css 

your problem related context property , file structure.

context - base directory (absolute path!) resolving entry option, webpack docs. in other words, folder webpack starts looking app. here 2 way how fix it:

  1. remove /app context property -> context: __dirname or can remove context weblack.config file

  2. move style folder app folder

thanks!


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -