Git Product home page Git Product logo

Comments (4)

bannmoore avatar bannmoore commented on May 28, 2024 1

Thanks for responding @eavichay .

For anyone else who comes across this, the polyfill did not resolve this specific problem (although it will be needed for older browsers). I was getting the above error in browsers that support the web components specification.

In order to use the latest slim-js in a project using @babel/preset-env, I needed to include it in the code transpiled through Babel and specifically call out the configuration in the rule options:

webpack.config.js:

      // module.rules
      {
        test: /\.js$/,
        exclude: /(node_modules(?!\/slim-js\/))/,
        use: {
          loader: 'babel-loader',
          options: {
            configFile: path.join(__dirname, '.babelrc')
          }
        }
      }

Since this fixes the eerror, I'll close this issue. Thanks again! 😄

from slim.js.

eavichay avatar eavichay commented on May 28, 2024

All web components suffer from this, native or via library.
Please refer to https://github.com/slimjs/slim-webpack-boilerplate. The babel config file uses class properties plug-in and in index.html the web components polyfill is loaded.
Unfortunately with babel transpiled to es5 you must use the polyfill.

from slim.js.

eavichay avatar eavichay commented on May 28, 2024

If you are addressing modern browsers that support custom elements without polyfill, then you may want to ditch babel. Consider working with rollup targeted as es6 modules.

from slim.js.

eavichay avatar eavichay commented on May 28, 2024

If you wish to start fresh PWA project based on slim-js, with typescript support (optional), sass/HTML/image loading via import, type npm init slimjs myProjectFolder

from slim.js.

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.