How to register module

1.4k Views Asked by At

I testing Aurelia framework and RethinkDB. How can I register Require and RethinkDB to access them from Aurelia ?

import {require} from "require" //require.js is missing

r = require("rethinkdb"); // require is not a function
2

There are 2 best solutions below

4
On

Using the ES6 module system's import syntax removes the need to use requirejs and the require function. SystemJS which Aurelia uses in the sample skeleton application can handle AMD formatted modules (which is the format Require uses).

That being said, rethinkdb would be on your server, not on the client, if I'm not mistaken.

0
On

Have you tried

import require from "require";

This would import the entire require module and doesn't expect an export named "require".