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

wrong export in typescript declaration #24

Closed
senaev opened this issue Nov 3, 2017 · 5 comments · May be fixed by #52
Closed

wrong export in typescript declaration #24

senaev opened this issue Nov 3, 2017 · 5 comments · May be fixed by #52
Labels

Comments

@senaev
Copy link

senaev commented Nov 3, 2017

in index.d.ts library exports in default property, but in ResizeObserver.js it exports as the full module.exports object

it should be

typeof exports === 'object' && typeof module !== 'undefined' ? module.exports.default = factory()

or

export = ResizeObserver;

instead of

export default ResizeObserver;
@TrySound
Copy link
Contributor

TrySound commented Nov 3, 2017

@senaev How do you use it? With bundler?

@senaev
Copy link
Author

senaev commented Nov 13, 2017

@TrySound yes, we're using webpack bundler. And I noticed that there is no troubles in webpack 3. Error occures in webpack 1.

@que-etc
Copy link
Owner

que-etc commented Nov 17, 2017

@senaev

I believe that it happens because bundlers like webpack 2+ and Rollup are using ES6 module version of the polyfill, which exports module with the export default statement.

Could you please consider updating your webpack version either to 2.x or 3.x as 1.x is officially deprecated?

@stormit-vn
Copy link

Hi all,

I am using webpack: 4.17.0 and latest angular version. I've tried to import this module, but I am getting below error

webpack-dev-server.js:1 [WDS] Errors while compiling. Reload prevented.
errors @ webpack-dev-server.js:1
webpack-dev-server.js:1 ./node_modules/resize-observer-polyfill/src/ResizeObserverSPI.js 13:24
Module parse failed: Unexpected token (13:24)
You may need an appropriate loader to handle this file type.
|      * @private {Array<ResizeObservation>}
|      */
>     activeObservations_ = [];
| 
|     /**
errors @ webpack-dev-server.js:1
webpack-dev-server.js:1 ./node_modules/resize-observer-polyfill/src/ResizeObserverController.js 23:15
Module parse failed: Unexpected token (23:15)
You may need an appropriate loader to handle this file type.
|      * @private {boolean}
|      */
>     connected_ = false;
| 
|     /**
errors @ webpack-dev-server.js:1
VM52394 localhost:8080:156 [WDS] Errors while compiling. Reload prevented.
errors @ VM52394 localhost:8080:156
VM52394 localhost:8080:162 ./node_modules/resize-observer-polyfill/src/ResizeObserverSPI.js 13:24
Module parse failed: Unexpected token (13:24)
You may need an appropriate loader to handle this file type.
|      * @private {Array<ResizeObservation>}
|      */
>     activeObservations_ = [];
| 
|     /**
errors @ VM52394 localhost:8080:162
VM52394 localhost:8080:162 ./node_modules/resize-observer-polyfill/src/ResizeObserverController.js 23:15
Module parse failed: Unexpected token (23:15)
You may need an appropriate loader to handle this file type.
|      * @private {boolean}
|      */
>     connected_ = false;
| 
|     /**
errors @ VM52394 localhost:8080:162
ResizeObserverController.js:1 Uncaught Error: Module parse failed: Unexpected token (23:15)
You may need an appropriate loader to handle this file type.
|      * @private {boolean}
|      */
>     connected_ = false;
| 
|     /**

    at eval (ResizeObserverController.js:1)
    at eval (ResizeObserverController.js:1)
    at Object../node_modules/resize-observer-polyfill/src/ResizeObserverController.js (main.bundle.js:7467)
    at __webpack_require__ (main.bundle.js:21)
    at eval (ResizeObserver.js:3)
    at eval (ResizeObserver.js:1)
    at Module../node_modules/resize-observer-polyfill/src/ResizeObserver.js (main.bundle.js:7456)
    at __webpack_require__ (main.bundle.js:21)
    at eval (index.js:2)
    at eval (index.js:1)
    at Module../node_modules/resize-observer-polyfill/src/index.js (main.bundle.js:7490)
    at __webpack_require__ (main.bundle.js:21)
    at eval (perfect-scrollbar.directive.js:4)
    at eval (perfect-scrollbar.directive.js:1)
    at Module../node_modules/ngx-perfect-scrollbar/dist/lib/perfect-scrollbar.directive.js (main.bundle.js:7085)
    at __webpack_require__ (main.bundle.js:21)
    at eval (perfect-scrollbar.component.js:7)
    at eval (perfect-scrollbar.component.js:1)
    at Module../node_modules/ngx-perfect-scrollbar/dist/lib/perfect-scrollbar.component.js (main.bundle.js:7073)
    at __webpack_require__ (main.bundle.js:21)
    at eval (index.js:2)
    at eval (index.js:1)
    at Module../node_modules/ngx-perfect-scrollbar/dist/index.js (main.bundle.js:7061)
    at __webpack_require__ (main.bundle.js:21)
    at eval (ngx-perfect-scrollbar.js:2)
    at eval (ngx-perfect-scrollbar.js:1)
    at Module../node_modules/ngx-perfect-scrollbar/dist/ngx-perfect-scrollbar.js (main.bundle.js:7121)
    at __webpack_require__ (main.bundle.js:21)
    at eval (shared.module.ts:16)
    at eval (shared.module.ts:1)
    at Object../src/app/shared/shared.module.ts (main.bundle.js:11260)
    at __webpack_require__ (main.bundle.js:21)
    at eval (core.module.ts:23)
    at eval (core.module.ts:1)
    at Object../src/app/core/core.module.ts (main.bundle.js:10365)
    at __webpack_require__ (main.bundle.js:21)
    at eval (index.ts:1)
    at eval (index.ts:1)
    at Object../src/app/core/index.ts (main.bundle.js:10425)
    at __webpack_require__ (main.bundle.js:21)
    at eval (app.module.ts:36)
    at eval (app.module.ts:1)
    at Object../src/app/app.module.ts (main.bundle.js:10165)
    at __webpack_require__ (main.bundle.js:21)
    at eval (index.ts:1)
    at eval (index.ts:1)
    at Object../src/app/index.ts (main.bundle.js:10651)
    at __webpack_require__ (main.bundle.js:21)
    at eval (main.browser.ts:11)
    at eval (main.browser.ts:1)
    at Object../src/main.browser.ts (main.bundle.js:14519)
    at __webpack_require__ (main.bundle.js:21)
    at eval (webpack://ac_%5Bname%5D/multi_(:8080/webpack)-dev-server/client?:2:18)
    at Object.1 (main.bundle.js:14530)
    at __webpack_require__ (main.bundle.js:21)
    at main.bundle.js:85
    at main.bundle.js:88

Does anyone have tried and make it works for anglar with webpack bundler?

@lulu-berlin
Copy link

lulu-berlin commented Mar 14, 2019

I'm having the same issue and have created a pull request (#52) that fixes it for me.

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

Successfully merging a pull request may close this issue.

5 participants