preact-router icon indicating copy to clipboard operation
preact-router copied to clipboard

Not able to build on Windows

Open laggingreflex opened this issue 7 years ago • 8 comments

Variable names in the script is preventing build on windows.

> uglifyjs $npm_package_main -cm -o $npm_package_minified_main -p relative --in-source-map ${npm_package_main}.map --source-map ${npm_package_minified_main}.map

fs.js:557
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open 'C:\...\Forks\preact-router\${npm_package_main}.map'
    at Object.fs.openSync (fs.js:557:18)
    at Object.fs.readFileSync (fs.js:467:33)
    at Object.<anonymous> (C:\...\Forks\preact-router\node_modules\uglify-js\bin\uglifyjs:285:30)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.runMain (module.js:607:10)
    at run (bootstrap_node.js:382:7)

related: #49

laggingreflex avatar Feb 26 '17 06:02 laggingreflex

Yes, this is a known issue, if you are on windows 10 you can try bash for windows

(but that crashes when you run the tests)

ForsakenHarmony avatar Feb 26 '17 13:02 ForsakenHarmony

Looking to switch to jsdom + node for the tests (likely via Jest) to fix this.

developit avatar Feb 26 '17 16:02 developit

yeah, the problem is that npm always uses cmd on windows to run the commands and the syntax for the variables would be different

ForsakenHarmony avatar Feb 26 '17 18:02 ForsakenHarmony

There's a module called cross-var that can help with that

developit avatar Feb 26 '17 18:02 developit

nvm, I'm stupid, I was thinking of cross-env, sorry

ForsakenHarmony avatar Feb 26 '17 22:02 ForsakenHarmony

but stuff like $(gzip-size $npm_package_minified_main) still won't work, which is sad

ForsakenHarmony avatar Feb 26 '17 22:02 ForsakenHarmony

@developit thoughts on a separate task runner like gulp or start-runner (it has suport for rollup and uglify)

laggingreflex avatar Feb 26 '17 22:02 laggingreflex

I'm not big on them. Rollup already supports 90% of what is needed here - for example, it can output gzipped bundle size. I'm just not using it properly :P

developit avatar Feb 26 '17 22:02 developit