-
Notifications
You must be signed in to change notification settings - Fork 70
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
(0.6.1) path problem #50
Comments
same problem |
same problem |
@tonimitrevski do u have the same problem with teplateUrl ended with comma symbol?
|
yup , but i try withcomma and it's fixed, but i have 100 component's that is the problem for now :) |
because of you, I spent the whole day, until I realized that this is a bug after upgrading to 0.6.1 |
Hey sorry about this folks. I'll take a look at this and fix right away. |
I don't have time to publish this just yet as I have to run, but I will be happy to do so tonight or tomorrow. |
Going to leave open until I publish fix. Thanks for your patience everyone. |
@TheLarkInn Have you had a chance to publish the fix yet? |
Closing as this is now published, thank you so much for being patient. Also looking for maintainers willing to help. |
Works again, thank you. Would be glad to help! Sent you an email but no response. How can I get in contact with you best? |
I think there still may be a issue here. I am really new to angular 2 and web pack. Working on my first project. I built from scratch using Full framework and the spa template as an example. Using version 0.6.2 in both and the core(standard 1.0) works fine like everyone else says. the Core(full .net) gives the same error as before. I was able to get the core(full) to work by going to 0.6.0 and adding the require statements as talked about above. I don't really understand how these two could be different since all of this should not be dependent on the framework but I can't figure it out. |
Hi everyone, Building and bundling goes fine, but then at runtime in dev console I see a couple of wrong HTML requests:
with their accompanying // some component file
templateUrl: './templates/default/color-picker.component.html',
// another component file
templateUrl: './component.html', and, by chance (for our code convetion), there's already a trailing comma. I also tried swapping single quotes for double quotes. I tried with angular2-template-loader 0.6.0 and 0.6.2, with no luck. Other dependencies:
Side note, in case might be related: EDIT bundled JS code still shows |
@GiuseppePiscopo, do any of your other templateUrls have this issue, or is it specific to these two templateUrls, or do you only have two components? It would be good if you could post the full @component metadata for each of these two cases. Also, just because why not, have you tried without the |
No. All templateUrls instances show up untouched in generated main-bundle.js. I have a couple of components with template, they of course are left with their string content. Then some components from node_modules dependencies show template with string content, but again those do not matter here. Same happens for styleUrls. Here's one of the many and similar component metadata, which worked until now: @Component({
selector: '[sideBar]',
templateUrl: './component.html',
styleUrls: ['./component.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SideBarComponent {
// ...
} found in some my\project\path\src\private\view\side-bar\ subdirectory, containing component.[css|html|ts] Tried also with EDIT Webpack configuration has not changed since switching from 2.1.0-beta.25 to 2.2.1. For typescript in JIT build is: test: /\.ts$/,
use: [
'awesome-typescript-loader',
'angular2-template-loader',
'angular-router-loader',
],
include: [
paths.clientSrc,
],
exclude: [
paths.nodeModules, // skip all node modules
paths.buildOutput, // skip output
paths.codegen, // skip (AOT) generated code
/\.(spec|e2e|async)\.ts$/, // skip all test and async TS files
], |
Oh well ... more findings: production AOT build goes fine and show no errors in console. Its (multiple) chunks generated out of custom code show all my templateUrl AOT build has typescript loaders changed to: typescript: {
test: /\.ts$/,
use: [
'awesome-typescript-loader?silent=true',
'angular2-template-loader',
'angular-router-loader?aot=true&debug=false&genDir=./codegen',
],
include: [
paths.clientSrc,
paths.codegen, // include (AOT) generated code
],
exclude: [
paths.nodeModules, // skip all node modules
paths.buildOutput, // skip output
/\.(spec|e2e|async)\.ts$/, // skip all test and async TS files
],
}, Development JIT build instead has only a main bundle for our custom code (beside vendor bundle, that is). But this main bundle only has components common to whole app, and their templateUrl is untouched. Furthermore, there are no component from other "lazy loaded" modules. It's like if angular-router-loader had no effect at all in JIT build. By peeking at other sample projects, JIT bundle should instead show something like |
I temporarily added logs to node_modules\angular2-template-loader\index.js, and replacement between original source and newSource does work:
But indeed when I look at whole bundled JS, I find: NotFoundComponent = tslib_1.__decorate([
core_1.Component({
selector: 'not-found',
templateUrl: './not-found.component.html',
styles: ["\n .container {\n margin-top: 40px;\n }\n "],
}),
tslib_1.__metadata("design:paramtypes", [router_1.Router])
], NotFoundComponent); as if loader output is somehow ignored. |
Are you using the latest versions of angular2-template-loader and awesome-typescript-loader? If not, you may need the config settings that were removed in this commit: beb5b95#diff-04c6e90faac2675aa89e2176d2eec7d8L65 |
Thanks for suggestion @nikolasleblanc . Project is using current latest versions: +-- [email protected] I missed that change in awesome-typescript-loader settings, hence this project still kept One more finding, which I think is moving the culprit somewhere else, is the following: I temporarily turned on debugging in angular-router-loader, and at least from its output one can say that replacement does happen:
while in main-bundle.js I still find |
One step more: temporarily added console logs to node_modules\awesome-typescript-loader\dist\index.js (original TS here), dumping Input text (excerpt): // ...
@Component({
selector: 'not-found',
template: require('./not-found.component.html'),
styles: [`
.container {
margin-top: 40px;
}
`],
})
export class NotFoundComponent implements OnInit {
// ... Output text (excerpt): // ...
NotFoundComponent = tslib_1.__decorate([
core_1.Component({
selector: 'not-found',
templateUrl: './not-found.component.html',
styles: ["\n .container {\n margin-top: 40px;\n }\n "],
}),
tslib_1.__metadata("design:paramtypes", [router_1.Router])
], NotFoundComponent);
// ... ?? why decorate shows back initial, original templateUrl instead of template + require, or something else? Might that be related to using tslib helpers instead of webpack TS helpers? EDIT Answer: nope, even skipping tslib helpers, same thing, with |
@nikolasleblanc still interested in some kind of repro? |
Sure if you've got one handy. Sorry, got swamped. |
No need for excuse. Sure, I'll send you something by email. |
Hi @GiuseppePiscopo, did you manage to sort out the issue? I'm having the same problem, 2 of my components template are reset back to "templateUrl". My current workaround is to swap angular2-template-loader and awesome-typescript-loader |
Hi there. At that time, I found some alternative workarounds:
Now, more recently, I'm running the build not from standalone command prompt, but from VS Code integrated terminal and for some reason I got no error, with project still being at original path. I also upgraded angular and webpack in meantime, but I'm not sure that matters. HTH |
Sorry, item 3: what I described is not the same switch as you described |
I encountered what might be the same problem; I found out the problem was that I had a bunch of compiled .js files lying around from running tsc manually. Deleting them resolved the issue, so what was probably happening was webpack was picking those up, rather than the ones output by the loaders. Lesson learned, hopefully this helps someone else. |
I had the issue with the comma missing, but only when there was a comment on the next line. templateUrl: "foo.html" works fine but ... templateUrl: "foo.html" |
Hi, |
Could not fix it. |
0.6.1 version doesn't recognize some of my relative paths.
This component
builds to
Looks like loader doesn't recognize templateUrl path.
When I roll back to 0.6.0 it works fine.
The text was updated successfully, but these errors were encountered: