-
Notifications
You must be signed in to change notification settings - Fork 519
Description
Description
The following error occurs when attempting to use class-transformer in my project.
Uncaught ReferenceError: exports is not defined
Additionally the following warning is shown in the terminal.
Warning: /libs/core/feature-components/src/core/fs-component.decorator.ts depends on 'class-transformer'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Minimal code-snippet showcasing the problem
The error occurs on import.
import {} from 'class-transformer'Expected behavior
Imports to use es5/es2015 formats when in the browser
Actual behavior
CommonJS import appears to be used.
Additional context
My configuration for this project is a little, special. I am rendering React Native Web inside of an Angular project. This is requiring me to use Babel on top of the Angular Webpack configuration. From what I can tell this kills commonjs, not entirely sure why. I attempted to use some babel plugins to correct this and using babel-plugin-transform-commonjs works so long as I use the default import of class-transformer but a few (such as @Type() end up on the default export.
In any case the solution appears to be just to ship ES Modules, which appears to already be planned, just not released yet.
Added in 26b5dac. It will be included in the next release.
Originally posted by @NoNameProvided in #344 (comment)
So my question is when I can expect this next release?
Can a beta version be released that I could play with in the mean time?