Giter VIP home page Giter VIP logo

Comments (7)

kaelzhang avatar kaelzhang commented on May 29, 2024 1

IMO the only problem is that babel-loader might slow down the compile phase of your project.

If b2a or every other javascript library compiles the module entry to target ie 11, and if somebody has a project which should be compatible with ie8, he still needs the babel-loader.

Then maybe another guy creates a project that only works for chrome, the polyfills(and ponyfills) of b2a for ie11 are completely unnecessary for him and also bad for performance.

So, I'd like not to compile the module entry of any library unless it contains some syntaxes which are not of ECMA standards.

from b2a.

kaelzhang avatar kaelzhang commented on May 29, 2024

I think we can use babel-loader for webpack.

module: {
    rules: [
      {
        test: /\.js$/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env']
          }
        }
      }
    ]
  }

from b2a.

KalachevDev avatar KalachevDev commented on May 29, 2024

@kaelzhang do you mean add this to our codebase? That's actually one of workarounds I was thinking about. But for me it seems a bit odd to transpile dependencies.

from b2a.

KalachevDev avatar KalachevDev commented on May 29, 2024

@kaelzhang gotcha. Thanks for answering, will stick with adding babel configuration!

from b2a.

kaelzhang avatar kaelzhang commented on May 29, 2024

Thanks for your understanding 😄

from b2a.

KalachevDev avatar KalachevDev commented on May 29, 2024

By the way, I was always thinking that main property in package.json is treated as module root. But that's not the truth (and also there is file lib/index.js that contains transpiled and IE compatible code, what's the purpose of it then?)

from b2a.

kaelzhang avatar kaelzhang commented on May 29, 2024

The main field of package.json indicates the entry for nodejs. And for most scenarios, we should not rely on babel(babel-node for example) to run a node application.

from b2a.

Related Issues (2)

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.