question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

-xi18n -p ./src/tsconfig.json fails due to scss import

See original GitHub issue

OS?

Ubuntu 16.04

Versions.

angular-cli: 1.0.0-beta.24 node: 6.5.0 os: linux x64 @angular/common: 2.3.1 @angular/compiler: 2.3.1 @angular/compiler-cli: 2.3.1 @angular/core: 2.3.1 @angular/flex-layout: 2.0.0-beta.1 @angular/forms: 2.3.1 @angular/http: 2.3.1 @angular/material: 2.0.0-beta.1 @angular/platform-browser: 2.3.1 @angular/platform-browser-dynamic: 2.3.1 @angular/router: 3.3.1

Repro steps.

Having something like @import '~@angular/material/core/theming/theming'; in a scss file is causing ./node_modules/.bin/ng-xi18n -p ./src/tsconfig.json to fail.

myI18nProject@0.0.0 i18n /home/user/projects/myI18nProject ng-xi18n -p ./src/tsconfig.json

The log given by the failure.

Error: Compilation failed. Resource file not found: /home/user/projects/myI18nProject/src/app/calendar/calendar-toolbar/~@angular/material/core/theming/theming
    at ModuleResolutionHostAdapter.readResource (/home/user/projects/myI18nProject/node_modules/@angular/compiler-cli/src/compiler_host.js:232:19)
    at CompilerHost.loadResource (/home/user/projects/myI18nProject/node_modules/@angular/compiler-cli/src/compiler_host.js:200:85)
    at Object.get (/home/user/projects/myI18nProject/node_modules/@angular/compiler/bundles/compiler.umd.js:27048:105)
    at DirectiveNormalizer._fetch (/home/user/projects/myI18nProject/node_modules/@angular/compiler/bundles/compiler.umd.js:13277:45)
    at /home/user/projects/myI18nProject/node_modules/@angular/compiler/bundles/compiler.umd.js:13394:55
    at Array.map (native)
    at DirectiveNormalizer._loadMissingExternalStylesheets (/home/user/projects/myI18nProject/node_modules/@angular/compiler/bundles/compiler.umd.js:13394:16)
    at /home/user/projects/myI18nProject/node_modules/@angular/compiler/bundles/compiler.umd.js:13397:28
    at process._tickCallback (internal/process/next_tick.js:103:7)
    at Module.runMain (module.js:592:11)
Extraction failed

Mention any other details that might be useful.

Only affects scss files of components. import in the global src/style.scss works just fine.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
CanKattwinkelcommented, Jan 9, 2017

I’m using this bash snippet for now, in order to remove all scss references before running ng-xi18n. (and then to re-add them)

Workaround:

# MAKE SURE TO HAVE ANY CHANGES COMMITTED BEFORE RUNNING THIS


if git diff-index --quiet HEAD --; then
	
    for FILE in `find src/ -name '*.component.ts'`
    do
        sed -i  '/^.*styleUrl.*$/d' $FILE;	
    done;
    ./node_modules/.bin/ng-xi18n -p ./src/tsconfig.json
    git add src/messages.xlf
    git checkout .


else
    echo "You need to commit your changes before you can continue!";
fi

use in project roots folder. Commit your changes, then run this script. It will remove all “styleUrls”-lines since they are not necessary for ng-xi18n command. After the message.xlf file is created/updated all other files will be reset to the last commit. Script will refuse to run if you have uncommitted changes.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 8, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng-xi18n script is failing as it is inspecting scss / sass files
node_modules/.bin/ng-xi18n -p src/tsconfig.json as it described on github. ... requires to compile components and resolve components' styles imports.
Read more >
baseUrl in tsconfig.json is ignored when resolving Sass ...
Imports in component specific sass files (e.g. app.component.scss ) are resolved relative to sourceRoot (i.e. src in this case), so that the following ......
Read more >
i18n + Angular CLI + AOT - Daniele Ghidoli
"i18n" : "ng-xi18n -p src/tsconfig.json --i18nFormat=xmb" ... For example, I had to change the import paths of all my scss files from this: ......
Read more >
Angular 5 Tutorial: Guide to Your First Angular 5 App - Toptal
Build a notes application from scratch for your first Angular 5 app. Learn Angular CLI, use RxJS, implement Firebase as the back-end, and...
Read more >
ng-uikit-pro-standard SCSS - Material Design for Bootstrap
@import "~ng-uikit-pro-standard/assets/scss/mdb.scss"; To the file causes the following error. ERROR in ./src/styles.scss (.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found