Skip to content

Can it be used as a module in the browser? #517

@LeMoussel

Description

@LeMoussel

Browsers have had support for loading ECMAScript modules directly (no tools like Webpack required)

in index.html, I do this

<!DOCTYPE html>
<html lang="fr">
  <head>
    <meta charset="UTF-8">
    <script type="module" src="neo4j.js"></script>
  </head>
  <body>
   // Do some stuff ....
  </body>
</html>

in neo4j.js

/*jshint esversion: 6 */

import neo4j from 'https://unpkg.com/neo4j-driver@4.0.1/lib/browser/neo4j-web.min.js';

I got this error

SyntaxError: The requested module 'https://unpkg.com/neo4j-driver@4.0.1/lib/browser/neo4j-web.min.js' does not provide an export named 'default'

With this

/*jshint esversion: 6 */

import { neo4j } from 'https://unpkg.com/neo4j-driver@4.0.1/lib/browser/neo4j-web.min.js';

I got

SyntaxError: The requested module 'https://unpkg.com/neo4j-driver@4.0.1/lib/browser/neo4j-web.min.js' does not provide an export named 'neo4j'

Is possible to use neo4j-javascript-driver has module in browser?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions