generator-angular2-library icon indicating copy to clipboard operation
generator-angular2-library copied to clipboard

Build "Error: Octal literal in strict mode" when css with content:"\123"

Open fabriziodebortoli opened this issue 7 years ago • 6 comments

In a library created with this generator (Thanks! It's awesome) I use a css like this:

.css-class:before {
    content: "\62";
}

Building with npm run build I have an error:

Starting 'rollup:fesm'...

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: Octal literal in strict mode
    at error (C:\Microarea\fabriziodebortoli\ng-icon\node_modules\rollup\dist\rollup.js:170:12)
    at Module.error$1 [as error] (C:\Microarea\fabriziodebortoli\ng-icon\node_modules\rollup\dist\rollup.js:8007:2)
    at tryParse (C:\Microarea\fabriziodebortoli\ng-icon\node_modules\rollup\dist\rollup.js:7710:10)
    at new Module (C:\Microarea\fabriziodebortoli\ng-icon\node_modules\rollup\dist\rollup.js:7745:14)
    at C:\Microarea\fabriziodebortoli\ng-icon\node_modules\rollup\dist\rollup.js:9495:17
    at process._tickCallback (internal/process/next_tick.js:109:7)

What can I try to do?

This is an example of library: https://github.com/fabriziodebortoli/ng-icon

fabriziodebortoli avatar Jun 08 '17 13:06 fabriziodebortoli

You could use useStrict: false to disable that check, writing that line here. I haven't tested it, but I think it will work you 👍

tonivj5 avatar Jun 12 '17 07:06 tonivj5

@fabriziodebortoli — Can you try to escape the value:

content: "\\62";

and let us know if that works? Thanks!

jvandemo avatar Jun 16 '17 06:06 jvandemo

You could use useStrict: false to disable that check, writing that line here. I haven't tested it, but I think it will work you 👍

@xxxtonixxx thanks but this is only a workaround, I would like to resolve... And rollup documentation says: ES6 modules are always in strict mode, so you shouldn't disable this without good reason.

Edit: I wanted to try the same but the option "useStrict" in the "gulp-rollup" is not used...

fabriziodebortoli avatar Jun 16 '17 07:06 fabriziodebortoli

@jvandemo - Escaping, build is ok but the icons will not be visible because the css "content" mapping will be wrong

fabriziodebortoli avatar Jun 16 '17 13:06 fabriziodebortoli

Hi ! Same problem here, by importing bootstrap-sass : $icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/"; @import "~bootstrap-sass/assets/stylesheets/bootstrap";

NicoTuxx avatar Sep 20 '17 06:09 NicoTuxx

I also have this problem when importing bootstrap library. Any ideas how to handle this? If I escape all the value with "{number}" in bootstrap node_modules everything works, but I don't want to change things in my node_modules..

xtoff avatar Nov 16 '17 12:11 xtoff