Cannot resolve directory static css

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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

Import url tries to resolve directory #67

Import url tries to resolve directory #67

Comments

Upon trying to @import «ProximaNova-font.css»;

./~/css-loader?importLoaders=2&localIdentName=[path][name]---[local]---[hash:base64:5]&url=false!./~/postcss-loader!./~/less-loader!./assets/styles/less/common/ProximaNova-font.css Module build failed: Cannot resolve 'file' or 'directory' .///hello.myfonts.net/count/2da629.less in /home/joe/www/frontend/assets/styles/less/common @ /home/joe/www/frontend/assets/styles/less/common/ProximaNova-font.css (line 39, column 0) near lines: /* @import must be at top of file, otherwise CSS will not work */ @import url('//hello.myfonts.net/count/2da629'); Error: Cannot resolve 'file' or 'directory' .///hello.myfonts.net/count/2da629.less in /home/joe/www/frontend/assets/styles/less/common @ /home/joe/www/frontend/assets/styles/less/common/ProximaNova-font.css (line 39, column 0) near lines: /* @import must be at top of file, otherwise CSS will not work */ @import url('//hello.myfonts.net/count/2da629'); at formatLessRenderError (/home/joe/www/frontend/node_modules/less-loader/index.js:173:12) at /home/joe/www/frontend/node_modules/less-loader/index.js:68:19 at /home/joe/www/frontend/node_modules/less/lib/less/render.js:26:35 at /home/joe/www/frontend/node_modules/less/lib/less/parse.js:62:33 at Object.finish [as _finish] (/home/joe/www/frontend/node_modules/less/lib/less/parser/parser.js:180:28) at Object.ImportVisitor._onSequencerEmpty (/home/joe/www/frontend/node_modules/less/lib/less/visitors/import-visitor.js:35:14) at ImportSequencer.tryRun (/home/joe/www/frontend/node_modules/less/lib/less/visitors/import-sequencer.js:50:14) at Object.ImportVisitor.run (/home/joe/www/frontend/node_modules/less/lib/less/visitors/import-visitor.js:29:25) at Object.Parser.parse (/home/joe/www/frontend/node_modules/less/lib/less/parser/parser.js:189:22) at Object.parse (/home/joe/www/frontend/node_modules/less/lib/less/parse.js:61:18) @ ./~/css-loader?importLoaders=2&localIdentName=[path][name]---[local]---[hash:base64:5]&url=false!./~/postcss-loader!./~/less-loader!./assets/styles/less/common/common.less 3:10-273 

I’m using the less loader in conjunction with the css module loader: my loader config is the following:

Читайте также:  Show map in html

The text was updated successfully, but these errors were encountered:

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

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

Module not found: Error: Cannot resolve ‘file’ or ‘directory’ (import sass with a relative font folder in webpack) #2771

Module not found: Error: Cannot resolve ‘file’ or ‘directory’ (import sass with a relative font folder in webpack) #2771

Comments

@import 'materialize/sass/materialize.scss'; . 

I also try @import ‘./materialize/sass/materialize.scss’; here
notwork.

It only work when I import the lib in index.js

import './styles/reset.css'; import './styles/main.scss'; import './styles/font-awesome/font-awesome.scss'; 
ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Thin.eot in E:\Project\simple-redux -boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:73945-73987 6:74010-74052 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Thin.woff2 in E:\Project\simple-red ux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:74104-74148 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Thin.woff in E:\Project\simple-redu x-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:74181-74224 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Thin.ttf in E:\Project\simple-redux -boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:74256-74298 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Light.eot in E:\Project\simple-redu x-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:74430-74473 6:74496-74539 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Light.woff2 in E:\Project\simple-re dux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:74591-74636 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Light.woff in E:\Project\simple-red ux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:74669-74713 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Light.ttf in E:\Project\simple-redu x-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:74745-74788 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Regular.eot in E:\Project\simple-re dux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:74922-74967 6:74990-75035 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Regular.woff2 in E:\Project\simple- redux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:75087-75134 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Regular.woff in E:\Project\simple-r edux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:75167-75213 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Regular.ttf in E:\Project\simple-re dux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:75245-75290 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Medium.eot in E:\Project\simple-red ux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:75401-75445 6:75468-75512 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Medium.woff2 in E:\Project\simple-r edux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:75564-75610 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Medium.woff in E:\Project\simple-re dux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:75643-75688 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Medium.ttf in E:\Project\simple-red ux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:75720-75764 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Bold.eot in E:\Project\simple-redux -boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:75875-75917 6:75940-75982 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Bold.woff2 in E:\Project\simple-red ux-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:76034-76078 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Bold.woff in E:\Project\simple-redu x-boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:76111-76154 ERROR in ./~/css-loader!./~/sass-loader!./src/styles/main.scss Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/roboto/Roboto-Bold.ttf in E:\Project\simple-redux -boilerplate\src\styles @ ./~/css-loader!./~/sass-loader!./src/styles/main.scss 6:76186-76228 

I found there are config in
/src/styles/materialize/sass/components/_variables.scss :

$roboto-font-path: "../fonts/roboto/" !default; 

It looks like webpack search for a wrong directory, not search fonts folder under materialize .

I got error every time when I put import sass lib in main.scss , which force me to put import to index.js . Webpack should take the responsibility to generate correct absolute path base on imported relative path.

The text was updated successfully, but these errors were encountered:

Источник

Issue

This is starting to bug me and I’d either like it turned off or fixed. So Webstorm has a sweet feature in it’s HTML parser that will attempt to resolve directories in strings that are supposed to reference a file in your project. For example:

two examples

Webstorm is correct. My front end code is all in /app but my server serves up files in app on the root, so in the web context /app is actually just / . As a side, this behavior also impacts my angular templates:

webstorm hates angular directive templateUrl

and my angular-ui routes (I imagine it would do that for regular angular routes as well).

webstorm hates angular routes templateUrl

Is there a way that I can change webstorm to treat /app as the root so this is a useful feature? If not, is there a way I can disable this? I tried going into the inspector, but couldn’t find an option for it:

webstorm inspector

And no, it’s not the XML one. I tried.

Solution

To make file references to a non-root folder in your project, you’ll need to mark that directory as a Resource. To do this, go to Settings > Directories and select your asset root folder from the right-hand panel. Then mark it as Resource Root by clicking the button above the file browser.

From the Jetbrains documentation, a Resource Root enables WebStorm to complete relative paths to resources under the selected folder. This means that you should use Resource Root on a folder that holds all the resources you would like to refer to (e.g. styles, scripts, . ).

This Answer collected from stackoverflow and tested by AngularFix community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Источник

Оцените статью