Coder Social home page Coder Social logo

ES6 code is not bundle safe about parse-usdl HOT 8 OPEN

coryshaw avatar coryshaw commented on September 18, 2024
ES6 code is not bundle safe

from parse-usdl.

Comments (8)

mvayngrib avatar mvayngrib commented on September 18, 2024 1

@coryshaw as you're already using webpack, you can just configure it to transpile this module to es5. Use babel-loader and limit it to transpiling only this module either with include or test (test: /node_modules\/parse-usdl\/.*?\.js$/)

from parse-usdl.

nathany avatar nathany commented on September 18, 2024

@mvayngrib I had some trouble getting the transpile to work. Should the parse-usdl library do the transpiling itself?

from parse-usdl.

nathany avatar nathany commented on September 18, 2024

I'm not sure what it takes to get the library to transpile and work with projects that may not even use babel. For such a small library, my current solution for IE11 support is to remove the ES6 (from a fork).

from parse-usdl.

mvayngrib avatar mvayngrib commented on September 18, 2024

@nathany the problem with transpilation in-library is we don't know who our users are. IE11 users will want it transpiled a different way from people using chrome. I think it's better to delegate this decision to the consumer of this library, who will use some combination of webpack and babel-preset-env to create the bundle that works in their particular environment.

from parse-usdl.

nathany avatar nathany commented on September 18, 2024

I'm not sure if there is a precedent from other libraries, but this is my first time running into this issue.

If the transpiled code isn't included, perhaps the solution is to provide better documentation in the README. As of yet, I haven't been able to get the transpiling working so that this library works in Internet Explorer 11 (yes, I know, why do we need to support IE 11 anyway, but we do).

from parse-usdl.

mvayngrib avatar mvayngrib commented on September 18, 2024

@nathany maybe I can help. What are you using to transpile the rest of your code? Babel with babel-preset-env + webpack is the standard these days, and they support transpiling per browser (including ie 11). Take a look at https://babeljs.io/docs/en/next/babel-preset-env.html

from parse-usdl.

mvayngrib avatar mvayngrib commented on September 18, 2024

i made a small example for you: https://github.com/mvayngrib/usdl-example

run: npm run build
open index.html (it will log a parsed usdl license to the console)
fiddle around with browser support in babel.config.js to see the differently transpiled code

edit: poking around, i see that usdl-example is not set up the ideal way. Webpack can invoke babel directly, see babel-loader

from parse-usdl.

nathany avatar nathany commented on September 18, 2024

Okay. Will have to get back to you on this. Thanks.

from parse-usdl.

Related Issues (7)

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.