acquia / waterwheel.js

A generic JavaScript helper library to query and manipulate Drupal 8 via core REST and JSON API
https://github.com/acquia/waterwheel.js
233 stars 26 forks source link

Cannot be used in es6 module #81

Open dravenk opened 5 years ago

dravenk commented 5 years ago
// Not work
import  "waterwheel";

// Not work
// import '../node_modules/waterwheel/lib/waterwheel.js'

// Not work
// import('waterwheel').then((RetrieveStore) => {
//     console.log("MyView1 loaded");
// }).catch((reason) => {
//     console.log("MyView1 failed to load", reason);
// });

console print these msg.

Uncaught TypeError: Cannot set property 'Waterwheel' of undefined
    at waterwheel.js:2
    at waterwheel.js:3

dependencies

    "@polymer/polymer": "^3.0.0",
    "@webcomponents/webcomponentsjs": "^2.0.0",
    "waterwheel": "git+https://github.com/acquia/waterwheel.js.git"

Google Chrome is up to date Version 69.0.3497.100 (Official Build) (64-bit)

npm . 6.4.1

dravenk commented 5 years ago
import Waterwheel from 'waterwheel/lib/waterwheel'
Uncaught SyntaxError: The requested module '../node_modules/waterwheel/lib/waterwheel.js' does not provide an export named 'default'

import 'waterwheel/lib/waterwheel'
waterwheel.js:1 Uncaught ReferenceError: require is not defined
    at waterwheel.js:1

import('waterwheel/lib/waterwheel');
retrieve-data.js:6 Uncaught ReferenceError: Waterwheel is not defined
    at retrieve-data.js:6
(anonymous) @ retrieve-data.js:6
waterwheel.js:1 Uncaught (in promise) ReferenceError: require is not defined
    at waterwheel.js:1

import * as Whaterwheel  from "waterwheel";
waterwheel.js:2 Uncaught TypeError: Cannot set property 'Waterwheel' of undefined
    at waterwheel.js:2
    at waterwheel.js:3
dravenk commented 5 years ago

In order to use es6, I fork this to https://github.com/dravenk/waterpower .