-
-
Notifications
You must be signed in to change notification settings - Fork 609
Closed
Description
I have my folder structure like so:
myApp
+-- src
| |-- index.js
| |-- index.css
+-- resources
| |-- fonts
| +-- images
| | |-- portrait.png
| | |-- bg.png
My webpack I have this
rules: [
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: { loader: 'css-loader', options: { url: true, root: 'http://localhost:8080/' } }
}),
exclude: /node_modules/
},
{
test: /(\.png|\.jpg|\.otf)$/,
use: ['file-loader?name=[name].[ext]&publicPath=assets/&outputPath=assets/']
}
]
In the index.js file I have this
import './resources/images/portrait.png' // <- this is handled by the file loader
import './index.css' // <- this should be handled by the ExtractTextPlugin and css-loader
// blah blah
export default Index;
In the index.css file I have this:
.background {
background: url('/assets/portrait.png') 0 center;
}
So I have to have { url: true }
in order for the { root: 'http://localhost:8080/' }
to be prepended - however, it seems like it's trying to make a js module and requiring in the asset, which isn't what I want.....
Is there anyway to prevent the css-loader from trying to resolve the url but still have the root prepended
Metadata
Metadata
Assignees
Labels
No labels