Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Since 3.0.0 version get "Error: Cannot find module" when using file paths with '~' #47

Open
g1un opened this issue Sep 24, 2018 · 4 comments

Comments

@g1un
Copy link

g1un commented Sep 24, 2018

Hie!
This is my project https://github.com/g1un/path-resolve-issue
I added "src/fonts" to my resolve.modules in webpack.config.js (https://github.com/g1un/path-resolve-issue/blob/test/webpack.config.js#L33) and tried to use fonts with path with '~' (https://github.com/g1un/path-resolve-issue/blob/test/src/scss/components/_fonts.scss#L4).
It works with [email protected], but do not with [email protected], giving:

ERROR in ./src/scss/style.scss
Module build failed (from ./node_modules/extract-loader/lib/extractLoader.js):
/Users/ilyasmal/work/bogdanovka/node_modules/resolve/lib/sync.js:45
    throw err;
    ^

Error: Cannot find module 'roboto-light.woff2' from '/Users/ilyasmal/work/bogdanovka/src/scss'
    at Function.module.exports [as sync] (/Users/ilyasmal/work/bogdanovka/node_modules/resolve/lib/sync.js:43:15)
    at /Users/ilyasmal/work/bogdanovka/node_modules/extract-loader/lib/extractLoader.js:100:60
    at require (/Users/ilyasmal/work/bogdanovka/node_modules/extract-loader/lib/extractLoader.js:93:86)
    at /Users/ilyasmal/work/bogdanovka/src/scss/style.scss:7:8341
    at ContextifyScript.Script.runInContext (vm.js:59:29)
    at ContextifyScript.Script.runInNewContext (vm.js:65:15)
    at /Users/ilyasmal/work/bogdanovka/node_modules/extract-loader/lib/extractLoader.js:132:20
    at Generator.next (<anonymous>)
    at step (/Users/ilyasmal/work/bogdanovka/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /Users/ilyasmal/work/bogdanovka/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
    at new Promise (<anonymous>)
    at new F (/Users/ilyasmal/work/bogdanovka/node_modules/core-js/library/modules/_export.js:36:28)
    at /Users/ilyasmal/work/bogdanovka/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12
    at evalModule (/Users/ilyasmal/work/bogdanovka/node_modules/extract-loader/lib/extractLoader.js:150:63)
    at evalDependencyGraph (/Users/ilyasmal/work/bogdanovka/node_modules/extract-loader/lib/extractLoader.js:152:12)
    at Object.<anonymous> (/Users/ilyasmal/work/bogdanovka/node_modules/extract-loader/lib/extractLoader.js:32:31)
 @ ./src/js/app.js 3:0-30
 @ ./src/js/dev.app.js
 @ multi (webpack)-dev-server/client?http://0.0.0.0:8080 ./src/js/dev.app.js
@g1un
Copy link
Author

g1un commented Sep 27, 2018

Ended up using https://github.com/webpack-contrib/mini-css-extract-plugin.
It works with '~' properly.

@philostler
Copy link

Also hitting this ATM.

@gombosg
Copy link

gombosg commented Oct 6, 2018

I'm not sure if this error is similar to #48. It seems to be. I submitted a repro example over there.

@bdwain
Copy link

bdwain commented Dec 14, 2018

I am seeing this issue too, and it's with an HTML file so the mins-css-extract-plugin doesn't work :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants