JavaScript Imports
Explore how to import JavaScript libraries into Python modules using Transcrypt. Understand using Node.js require() for ES5 imports, handling ES6 default and named exports, and importing static images for React front-ends. This lesson helps you bridge JavaScript and Python to build coherent web projects.
We'll cover the following...
JavaScript imports
We covered a few different ways of importing JavaScript libraries into the scope of our Python projects early on. Moving forward, we’ll assume that you are using the Parcel web application bundler and npm to locally store copies of the JavaScript libraries that will be used in the project. That said, the primary import of a JavaScript library will use the Node.js require() function like this:
React = require('react')
This ES5 style statement will cause the application bundler to import the JavaScript ...