Closed PieterSwitten closed 7 years ago
What does the path look like in the import?
background-image: url('/images/svg/myimage.svg')
Oh, I see, and you expect this to load from your server root, right?
Yes indeed
Thanks, will try and get this fixed soon.
Hey @PieterSwitten I tried recreating, but I think my code is a bit different from yours.
Looking below, I have an npm dependency that is being required, and it's url() contains an absolute url. However this loads fine. How is this example different from your code?
First I also installed my component as a 'normal' package and then it worked. The problem was when I published it to a private npm package with a scope and then installed it.
The package is like this in the package.json:
"dependencies": {
"@my-scope/my-package": "^1.0.1",
"steal-less": "^1.1.0",
....
}
In the /node_modules the structure is like
node_modules
|– ...
|– @my-scope
|– my-package
|– ...
|– steal-less
It looks like steal-less is seeing the @my-scope
as the root. With other packages earlier I had indeed no problem
Ok, how are you importing the less file that is in @my-scope/my-package
?
The first less file is imported from the javascript like
import './my-component.less';
Within my-component.less I import an image.less file which handles the paths to the images. In the less file it's imported like this
import '../styles/image/image.less';
Yeah, but how is @my-scope/my-package/styles.less
imported?
Ok, when I stuck my dependency in node_modules/@priv/dep
now I see the problem (I think). Going to see what is going on.
The underlying bug is in https://github.com/stealjs/steal/issues/1253, will track the fix there.
I have a private npm package installed in my project where I have an absolute path to some image outside of my private package. There is an error thrown that it cannot find the image with the path
'..../node_modules/@scope/images/svg/...'
It looks like it cannot go outside my scope.After I build the application the image links to the correct location.