Closed
Description
Hi! I have a webpack config:
module.exports = {
entry: [
'babel-polyfill',
'./src/index',
],
resolve: {
extensions: ['', '.js', '.jsx', '.json'],
modulesDirectories: [
'node_modules',
'src',
],
alias: {
components: 'components',
containers: 'containers',
nav: 'nav',
},
},
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: './dist/',
},
module: {
loaders: [
{
test: /\.(jpg|gif|png|svg)$/,
loader: 'url?name=[path][name].[ext]&limit=10000',
},
{
test: /\.css$/,
loaders: [
'style',
'css?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]',
'postcss',
],
},
],
},
},
And, I have a module in the path: src/components/LeftPane/index.js
.
The module imported a css file import classNames from './assets/style.css'
The css file have the string background: url(./logo.png)
.
Problem: Cannot resolve module 'logo.png' in /path//app-root/src/components/LeftPane/assets
, but logo.png
in the path.
I tried to change ./logo.png
to other variants:
logo.png
- cannot resolve
/logo.png
- resolve (WTF?), but don't copy to dist
components/LeftPane/assets/logo.png
- resolve and copy the logo.png
to dist
../assets/logo.png
- resolve and copy the logo.png
to dist
How to make so that was resolved locally? (./logo.png
)