Importing modules - "This code cannot be interpreted as javascript..."

Thanks for the fast response @Kayami. Turns out module2 doesn’t need the fix-esm npm, but using require (vs. import) did the trick:

// Doesn't work --> import {module2} from "module2";
// this works:
const { module2 } = require('module2');

Very strange. Like you said, it may be the older version of Node that Bubble is using to support plugins. Enabling fix-esm also worked, but added a significant amount of processing time to my application. It’s good to know the package exists to fix ESM import errors though.

3 Likes