Does not work on Windows 10 OS?
hjlld opened this issue · 5 comments
hjlld commented
First here's my webpack.config.js:
test: /assets\/lib\/babylon.js/,
use: [
{
loader: 'expose-loader',
query: 'BABYLON'
}
]
Then I found a weird thing, with a totally same project and its code:
- After building on Windows 10 OS, window.BABYLON is not defined.
- But after building on Mac or Linux, window.BABYLON is OK.
alexander-akait commented
@hjlld please create minimal reproducible test repo, thanks!
hjlld commented
@evilebottnawi sorry for my late reply. Try this repo:
https://github.com/hjlld/expose-example
- npm install
- npm run build
- run a http server , and open index.html in browser.
- Try it again on another OS (Windows 10 versus Linux / Mac), then you'll get it.
gbellini79 commented
We just had the same problem.
On Windows apparently the file path comes with \ instead of /. So in your RegEx you should handle both cases as: /assets[\\\/]lib[\\\/]babylon\.js$/
(http://regexr.com/3geks)
timse commented
I assume this can be closed?
Given the loader can't do anything about how webpack handles the test-regexp, and the above mentioned regexp just doesnt match under windows? @d3viant0ne
michael-ciniawsky commented