monaca / monaca-lib

npm package for handling Monaca cloud API and local debugging API
http://monaca.io
Other
14 stars 11 forks source link

Fix webpack setting templates which are broken on Windows. #105

Closed asial-matagawa closed 7 years ago

asial-matagawa commented 7 years ago

@adamkozuch @andipavllo (Cc: @frandiox @masahirotanaka @keijiodagawa ) This PR fixes monaca/monaca-cli#83 and OnsenUI/OnsenUI#2037.

The current webpack settings have the following line,

include: [/\/onsen-css-components.css$/, path.join(__dirname, 'src')],

but this works only on Linux/macOS since /\/onsen-css-components.css$/ contains a platform-dependent path delimiter /. In Windows, users will have a path like C:\Users\Foo\Documents\node_modules\onsenui\css-components-src\src\onsen-css-components.css but it does not match /\/onsen-css-components.css$/. To prevent this, we have to use path.join('foo', 'bar') which uses / on Linux/macOS and \ on Windows.

I tested the new webpack settings which this PR provides and they worked fine on both macOS and Windows. Could you merge this and release new versions of monaca-lib, Monaca CLI and Monaca Localkit?

andipavllo commented 7 years ago

thank you @asial-matagawa ! We will test it and release a new version :)

asial-matagawa commented 7 years ago

@adamkozuch Thank you, I did not know about loaders... They have been fixed now.

frandiox commented 7 years ago

@asial-matagawa Thanks! Just one thing, path.sep should contain the right separator for every platform, maybe you can use it as well.

asial-matagawa commented 7 years ago

I see, I will use path.sep as needed. Thank you!