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

Build library for ES6 #948

Closed
CoreAngel opened this issue Apr 27, 2023 · 1 comment
Closed

Build library for ES6 #948

CoreAngel opened this issue Apr 27, 2023 · 1 comment
Labels

Comments

@CoreAngel
Copy link

Describe the bug

Referring to the migration guide from v4 to v5

@photo-sphere-viewer packages use modern ES6 syntax, which is supported by all major browsers. This means you will need a transpiler like Babel if you want to support oldest browsers.

but the library is building to es2021. Is it possible to build a library for es2015?

Online demo URL

No response

Photo Sphere Viewer version

5.1.5

Plugins loaded

No response

OS & browser

Windows 11

Additional context

I'm using a library in angular which uses webpack 4.x.x under the hood and trying to migrate from v4 to v5 but having problem with building as it doesn't recognize ?. and ?? which are part of es2020.

ERROR in ./node_modules/@photo-sphere-viewer/core/index.module.js 270:10
Module parse failed: Unexpected token (270:10)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
| function getClosest(el, selector) {
>   if (!el?.matches) {
|     return null;
|   }

This is probably a webpack bug that was fixed in v5.x.x. webpack/webpack#10227

@CoreAngel CoreAngel added the bug label Apr 27, 2023
@mistic100
Copy link
Owner

I will not change the target language level.

This should be fixable with a proper configuration of your bundler like the temporary solutions mentionned in the webpack issue, and this guide for example https://danw1ld.medium.com/optional-chaining-for-javascript-with-babel-7-and-webpack-4-2de8fd9dbdd5

If you cannot upgrade Angular this builder allows to customize the webpack config https://www.npmjs.com/package/@angular-builders/custom-webpack

@mistic100 mistic100 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants