Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Build on windows... #44

Closed
benoitmangili opened this issue Sep 29, 2017 · 0 comments · Fixed by #45
Closed

Build on windows... #44

benoitmangili opened this issue Sep 29, 2017 · 0 comments · Fixed by #45

Comments

@benoitmangili
Copy link

I have issues when trying to run the build scripts of the package.json.
When running builder run build (for example), it complains

undefined:1
'{BABEL_ENV:commonjs}'
^

SyntaxError: Unexpected token ' in JSON at position 0
    at JSON.parse (<anonymous>)
    at parse (C:\somepath\node_modules\builder\lib\utils\json.js:36:19)
    at module.exports.Environment.updateEnvFlag (C:\somepath\node_modules\builder\lib\environment.js:153:17)
    at new module.exports (C:\somepath\node_modules\builder\lib\environment.js:64:8)
    at module.exports (C:\somepath\node_modules\builder\bin\builder-core.js:32:13)
    at Object.<anonymous> (C:\somepath\node_modules\builder\bin\builder.js:43:1)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)

It's most certainly a problem with my windows dev box... In fact, it complains because the string given as argument through --env is not escaped properly.

I've manage to fix it by changing these lines:

"build-es": "builder run --env '{\"BABEL_ENV\":\"es\"}' build-babel -- -d es"
"build-lib": "builder run --env '{\"BABEL_ENV\":\"commonjs\"}' build-babel -- -d lib",

into:

"build-es": "builder run --env \"{\\\"BABEL_ENV\\\":\\\"es\\\"}\" build-babel -- -d es"
"build-lib": "builder run --env \"{\\\"BABEL_ENV\\\":\\\"commonjs\\\"}\" build-babel -- -d lib",

What is wrong ? is it my setup ? my node ?

ryan-roemer added a commit that referenced this issue Sep 30, 2017
* Make --env strings windows-compliant. Fixes #44 
* Better babel config.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant