Node12 import error bokeh 2.0

I have made a solution for this to anyone who might be interested.

Run the following commands:

npm install @craco/craco
npm install --save-dev @babel/plugin-proposal-export-namespace-from
touch craco.config.js

Add the following content to craco.config.js

module.exports = {
  babel: {
    plugins: ["@babel/plugin-proposal-export-namespace-from"]
  }
};

In package.json, change the following lines:

  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

to

  "scripts": {
    "start": "craco start",
    "build": "craco build",
    "test": "craco test",
    "eject": "react-scripts eject"
  },

Now it should be possible to do

import * as Bokeh from "@bokeh/bokehjs";

and thereby use bokeh 2.0 in create-react-app without using eject and without using CDN

3 Likes