R
R
retr02019-09-27 00:01:32
JavaScript
retr0, 2019-09-27 00:01:32

How to properly import npm modules into browser js?

I have a js code that needs to be run in a browser, with the following syntax:

import { something } from 'module1'
import { something } from 'module2'

...

module1 and module2 are modules from npm. Tried Browserify but it throws an error:
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
. On the Internet, unfortunately, I did not find anything sensible about this.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question