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

ParseError: 'import' and 'export' may appear only with 'sourceType: module' when trying to #28

Open
cosmikwolf opened this issue Dec 23, 2021 · 3 comments

Comments

@cosmikwolf
Copy link

when I put the following in my code:

import { getOriginPrivateDirectory } from 'native-file-system-adapter'

I get the following error in the browser console:

node_modules/native-file-system-adapter/src/es6.js:1
import showDirectoryPicker from './showDirectoryPicker.js'
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
bundleError @ 07_meltimush_webcodecs_fileapi:4
(anonymous) @ 07_meltimush_webcodecs_fileapi:231

Any idea what other information I can gather to figure out what is going on? My searches have pointed me towards browserify or gulp, but I am not sure what changes to try.

@olee
Copy link

olee commented May 30, 2022

This is actually a more general issue of this library being not having a properly built version at all.
While there exists a rollup config etc. the npm package does not have any dist directory.

@jimmywarting would you mind publishing a new package which contains a built version of the library?

@jimmywarting
Copy link
Owner

it have kind of bit me as well with regards to extending the streams. Sometimes I wished that the bundle wouldn't include the stream polyfill at all but it's get included for whatever reason when i use my own bundler or any cdn.

I'm thinking of removing the hole stream polyfill dependency alltogheter and demand that the users use it in a environment that has the support for it

@jcbhmr
Copy link

jcbhmr commented Jun 5, 2023

I'm thinking of removing the hole stream polyfill dependency alltogheter and demand that the users use it in a environment that has the support for it

Considering the 95% browser support, I think this is a good idea. https://caniuse.com/streams
image
Related: https://caniuse.com/mdn-api_readablestream https://caniuse.com/mdn-api_writablestream https://caniuse.com/mdn-api_transformstream

Remember, you can always provide an example! Like:

import "streams-polyfill-from-somewhere"
import "your-polyfill-that-needs-TransformStream-or-something"

I also think that including browser support matrices from something like https://caniuse.bitsofco.de/ is a big plus! 😊

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

4 participants