Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import node module into project? #197

Closed
dravenk opened this issue Oct 15, 2018 · 2 comments
Closed

How to import node module into project? #197

dravenk opened this issue Oct 15, 2018 · 2 comments

Comments

@dravenk
Copy link

dravenk commented Oct 15, 2018

Failed to introduce a third-party package.
https://github.com/acquia/waterwheel.js

// 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

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
Copy link
Author

dravenk commented Oct 15, 2018

acquia/waterwheel.js#81

@keanulee
Copy link
Contributor

That library is not vended as an ES module - see Polymer/pwa-starter-kit#199 and "Can’t add libraries not distributed as an ES module (ESM)" at https://polymer.github.io/pwa-starter-kit/faq/ for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants