-
-
Notifications
You must be signed in to change notification settings - Fork 40
Cannot include styleUrls #36
Comments
Oh, this is bad. :( I reproduced it, and it starts complaining with that I found an ugly way to make it work though. You could add an npm script for the Angular "ngc": "ngc" and invoke it on the command line with:
That will generate the factories, and fail with an error since our loader that fixes import paths hasn't been applied. Anyway, just having the *.ngfactory.ts files lying around in your directory will make the next bundling invocation succeed:
I don't know what to think about this! :( |
Thank you, the suggested workaround works for me. I tried and found another solution. I used the webpack.common.js from the nativescript-sdk-examples-ng. But now, I have a further problem. With both solution I cannot use platform-dependent *.css files (template.android.css or template.ios.css)
I get the error: I thought that the webpack extension support the platform-dependent *.css files. In webpack.common.js I found following lines:
Have you any solutions? Thanks. |
Unfortunately that feature isn't supported yet. I recommend that you use a single CSS file and use different selectors for the two platforms. For example: .android .my-component {
...
}
.ios .my-component {
...
} |
Ah okay, thanks for the fast answer. But when I use only one Button-Element in my template.html
How can I distinguish between Android and iOS with two separate selector? |
So the workaround can be summarized as 2 scripts for package.json (because seems it needs to be reverted to run the normal tns run):
|
When given an url "./style.css" and the resource "style.css" does not exist in the current directory, the plugin will change the url to "style.android|ios.css". The target platform should be provided in the options of the plugin. Closes #36
When given an url "./style.css" and the resource "style.css" does not exist in the current directory, the plugin will change the url to "style.android|ios.css". The target platform should be provided in the options of the plugin. Closes #36
Hi @sis0k0 does this fix for |
@bnussey Did you found any solution for the issue, i am also getting the same error |
Any solution to this yet? |
I believe they rolled this out in one of the recent versions. |
@bnussey How about platform-specific templates within node_modules?? |
Still facing this problem. :( Code@Component({
selector: 'TopBar',
moduleId: module.id,
templateUrl: './topbar.component.html',
styleUrls: ['./topbar.component.css']
})
export class TopbarComponent implements OnInit {} Compile ErrorERROR Error: Uncaught (in promise): Error: Could not resolve /data/data/org.nativescript.Newzzz/files/app/app/shared/topbar/topbar.component.css. Looked for: /data/data/org.nativescript.Newzzz/files/app/app/shared/topbar/topbar.component.css.
JS: Error: Could not resolve /data/data/org.nativescript.Newzzz/files/app/app/shared/topbar/topbar.component.css. Looked for: /data/data/org.nativescript.Newzzz/files/app/app/shared/topbar/topbar.component.css.
JS: at FileSystemResourceLoader.resolve (file:///data/data/org.nativescript.Newzzz/files/app/tns_modules/nativescript-angular/resource-loader.js:33:19) [angular]
JS: at FileSystemResourceLoader.get (file:///data/data/org.nativescript.Newzzz/files/app/tns_modules/nativescript-angular/resource-loader.js:19:33) [angular]
JS: at DirectiveNormalizer._fetch (file:///data/data/org.nativescript.Newzzz/files/app/tns_modules/@angular/compiler/bundles/compiler.umd.js:16229:47) [angular]
JS: at file:///data/data/org.nativescript.Newzzz/files/app/tns_modules/@angular/compiler/bund... |
@rahadur share a sample app or Playground that reproduces the issue. All of our templates are using |
Hi,
I use nativescript-dev-webpack in a nativescript project with angular 2 support. Now I have the problem that I cannot build my simple project with "npm run start-ios-bundle" when I include styleUrls in a component.
@Component({ selector: "page-login", templateUrl: "login.html", styleUrls: ["login.css"] })
I get following error:
ERROR in ./main.aot.ts Module not found: Error: Can't resolve './app.module.ngfactory' in '/Users/marouane/Desktop/test-ios/app' @ ./main.aot.ts 2:0-60
So when I remove the styleUrls entry in my component all works fine. I think webpack cannot find my stylesheets (*.css). I tried a lot of variations, but I cannot compile.
Can you help me please... thx
The text was updated successfully, but these errors were encountered: