Closed rddmoreira closed 5 years ago
This PR just adds a babel plugin to transform the library into an es2015 UMD module. That way the plugin can be used in async js loaders libraries like require.js. More information about the plugin: https://babeljs.io/docs/en/babel-plugin-transform-es2015-modules-umd
require.js
Usage: <script> require.config({ paths: { 'react': 'https://unpkg.com/react@16/umd/react.production.min', 'react-dom': 'https://unpkg.com/react-dom@16/umd/react-dom.production.min', 'react-dom/server': 'https://unpkg.com/react-dom@16/umd/react-dom-server.browser.production.min', 'hypernova': 'https://cdn.jsdelivr.net/npm/hypernova@2.5.0/lib/index.min', 'hypernova-react': 'https://cdn.jsdelivr.net/npm/hypernova-react@2.1.0/lib/index.min', }, waitSeconds: 15 }); require(['react', 'react-dom', 'react-dom/server', 'hypernova', 'hypernova-react'], function(React, ReactDOM, ReactDOMServer, hypernova, hypernovaReact){ console.log('react -> ', React); console.log('react-dom -> ', ReactDOM); console.log('react-dom-server ->', ReactDOMServer); console.log('hypernova -> ', hypernova); console.log('hypernova-react -> ', hypernovaReact); /* your client side script */ }); </script>
No thanks; AMD is obsolete, and this is a transformation that’s relatively easy to configure in your bundler (which you’d have to do anyways to be able to consume the vast majority of npm).
This PR just adds a babel plugin to transform the library into an es2015 UMD module. That way the plugin can be used in async js loaders libraries like
require.js
. More information about the plugin: https://babeljs.io/docs/en/babel-plugin-transform-es2015-modules-umd