Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Quokka.js recognize local modules

I'm looking for a clear way to either require

const MyModel = require("../../models/MyModel");

or import

import MyModel from "../../models/MyModel";

local modules in a way that Quokka understands in ES6. Both approaches compile and do not throw errors on runtime. However, Quokka either says the require code has an "Unexpected Identifier" or ignores the import code line entirely.

like image 995
Joseph Avatar asked Oct 17 '25 11:10

Joseph


1 Answers

Quokka supports module imports only for pro version. If you are ready to go, there might be additional configuration needed. You can configure inside the package.json file, the settings below:

"quokka" : {
    "babel" : {
        presets: ['env']
    }
 }

Also you are able to set it as global on ~/.quokka/config.json

like image 81
Halil Irmak Avatar answered Oct 19 '25 01:10

Halil Irmak