Closed b1r1b1r1 closed 5 years ago
Parcel resolves ~
to the nearest folder containing node_modules
, so you usually need to do something like this: ~/node_modules/easymde/dist/easymde.min.css
Does this work for your?
Docs: https://parceljs.org/module_resolution.html#~-tilde-paths
Yes, it works, thank you. But what does package root: the directory of the nearest module root in node_modules
in docs stand for?
Basically the same as nearest package root
:
The algorithm goes up one level in the file hierarchy and stops when the next level up would be node_modules
or the root of your project was reached.
pkg-1
|- src
|- index.js (`~` resolves to `pkg-1` because of project root )
|- node_modules
|- some-dep
|- index.js (`~` resolves to `some-dep` because of node_modules)
Thank you.
π bug report
Tilde path does not work when importing css from node_modules
π Configuration (.babelrc, package.json, cli command)
.sassrc
package.json
cli command
main.scss
@import '~/easymde/dist/easymde.min.css';
index.js
import './main.scss';
π€ Expected Behavior
Parcel should bundle everything without errors
π― Current Behavior
I get the next error:
/Users/xmikasax/git/parcel_css_import_mwe/main.scss:1:1: Cannot resolve dependency '~/easymde/dist/easymde.min.css' at '/Users/xmikasax/git/parcel_css_import_mwe/~/easymde/dist/easymde.min.css'
π Possible Solution
The reason might be in package name (it is 'react-simplemde-editor') while its folder with styles in node_modules is 'easymde'
π¦ Context
π» Code Sample
https://github.com/xmikasax/parcel_css_import_mwe
π Your Environment