Giter Club home page Giter Club logo

Comments (3)

jingsam avatar jingsam commented on August 26, 2024

Seems that we set configFile: false to disable babel to read external babel.config.js

from underreact.

kepta avatar kepta commented on August 26, 2024

@jingsam it is intentional not to compile non-standard Javascript (flow) in the node_modules. To get around this problem, you will have to manually compile mapbox-gl-style-spec like this:

// underreact.config.js
module.exports = {
  webpackConfigTransform: config => {
    injectGlStyleSpecLoader(config);
    return config;
  }
};

function injectGlStyleSpecLoader(webpackConfig) {
  const rulesOneOf = webpackConfig.module.rules.find(obj => obj.oneOf).oneOf;
  // The first loader is the regular javascript loader
  const myLoader = Object.assign({}, rulesOneOf[0], {
    exclude: undefined,
    include: new RegExp(
      '^' +
        path.resolve(
          __dirname,
          'node_modules/@mapbox/mapbox-gl-style-spec/(?!dist)'
        )
    )
  });
  rulesOneOf.unshift(myLoader);
}

from underreact.

jingsam avatar jingsam commented on August 26, 2024

@kepta Do you mean standard Javascript is the code that conform @mapbox/babel-preset-mapbox? I think the standard one is just use default babel setting, no other preset.

I think when users specify compileNodeModules: [] option, they definitely want to compile there modules by their project wide babel config. Don't you think your solution to compile mapbox-gl-style-spec is not elegant?

from underreact.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.