aurelia / webpack-plugin

A plugin for webpack that enables bundling Aurelia applications.
MIT License
90 stars 36 forks source link

Html for component doesn't included in the bundle #128

Closed Boychenko closed 6 years ago

Boychenko commented 6 years ago

I'm submitting a bug report I'm submitting a feature request

Please tell us about your environment:

Current behavior: Took this sample https://github.com/jods4/aurelia-webpack-build/tree/master/demos/02-Traced_deps run npm i run webpack run npm run web Got

bundle.js:26193 Uncaught (in promise) Error: Unable to find module with ID: app.html
    at WebpackLoader.<anonymous> (bundle.js:26193)
    at step (bundle.js:26042)
    at Object.next (bundle.js:26023)
    at bundle.js:26017
    at new Promise (<anonymous>)
    at 77.__awaiter (bundle.js:26013)
    at WebpackLoader.77.WebpackLoader._import (bundle.js:26158)
    at WebpackLoader.<anonymous> (bundle.js:26258)
    at step (bundle.js:26042)
    at Object.next (bundle.js:26023)

Expected/desired behavior:

I made some investigation. webpack --display-modules gives windows:

  [39] Samples/demos/02-Traced_deps/node_modules/style-loader/lib/urls.js 3.01 kB {0} [built]
[app] Samples/demos/02-Traced_deps/src/app.ts 196 bytes {0} [built]
[aurelia-event-aggregator] Samples/demos/02-Traced_deps/node_modules/aurelia-event-aggregator/dist/native-modules/aurelia-event-aggregator.js 2.89 kB {0} [built]

ubuntu:

 [40] ./node_modules/style-loader/lib/urls.js 3.01 kB {0} [built]
[app] ./src/app.ts 188 bytes {0} [built]
[app.html] ./src/app.html 309 bytes {0} [built]
[aurelia-event-aggregator] ./node_modules/aurelia-event-aggregator/dist/native-modules/aurelia-event-aggregator.js 2.89 kB {0} [built]

It's seems to me that it's path issue. Probably this "./" causes the problem on this line https://github.com/aurelia/webpack-plugin/blob/e7935cf81f8f710f340865af9c557c263068db01/src/ConventionDependenciesPlugin.ts#L37 but I'm not sure.

jods4 commented 6 years ago

If I understand you correctly it works on Ubuntu but not on Windows? So it would be some kind of path and slashes issue?

That's very weird because I am on Windows and it works for me. I'm using Yarn as package manager and I doing:

yarn
yarn run web 

Does work as expected???

It would be nice to find out what's different on your machine. I can only assume that either:

Boychenko commented 6 years ago

Hi @jods4 Because I've tested this flow on 5-6 windows machines and it works as expected everywhere (win7, win10). Apart from my laptop. I've tried to remove node completely and install 8.7 and 6.11.4. Finally, I got this work on "Bash on Ubuntu on Windows"

yarn gives exactly same result

So, I'm thinking about this "Some weird OS config somewhere is different?". Can you give me a hint what settings I can check? I'm going to do some debugging during a weekend.

UPDATE

I've looked at the source and found some code related to symlinks. It was an issue. My path contained a symlink.

jods4 commented 6 years ago

OK then, glad you found out!

Symlinks should work (that's how I work and test new versions of aurelia modules before they get published) if you set the environment variable NODE_PRESERVE_SYMLINKS

Boychenko commented 6 years ago

@jods4 I think it'd be really cool to have this info in the somewhere in the wiki. Anyone can run into this issue since because of this fresh app generated via au new with webpack selected not working with symlink the path.