stealjs / steal

Gets JavaScript
https://stealjs.com
MIT License
1.36k stars 522 forks source link

Cannot specify babel path in stealconfig #1519

Open donkeybanana opened 4 years ago

donkeybanana commented 4 years ago

How often can you reproduce it?

Description:

https://stealjs.com/docs/StealJS.babel.html#specifying-version states:

If you have a code-base that needs a specific version of Babel you can include it using paths config.

I have tried doing so for both npm config and stealconfig.js approaches.

Looks like this line is the culprit https://github.com/stealjs/steal/blob/master/steal.js#L6889 as replacing with the following results in the paths override working correctly:

setIfNotPresent(this.paths,"babel", dirname+"/ext/babel.js");

Steps to reproduce:

  1. npm install -S steal@2 babel-standalone
  2. Configure paths as per https://stealjs.com/docs/StealJS.babel.html#specifying-version
  3. Create and load an ES module so it is transpiled (and therefore Babel is loaded)
{
  "steal": {
    "paths": {
      "babel": "node_modules/babel-standalone/babel.js"
    }
  }
}

Expected results:

Babel is loaded from node_modules/babel-standalone/babel.js.

Actual results:

Babel is loaded from node_modules/steal/ext/babel.js.

Environment:

Software Version
Steal version "steal": "^2.2.4"
Steal-tools version "steal-tools": "^2.2.6"
node -v v12.16.3
npm -v 6.14.4
Browser Chrome
Operating system 5.4.40-1-MANJARO