ngxs-labs / emitter

:octopus: New pattern that provides the opportunity to feel free from actions
MIT License
110 stars 5 forks source link

The id is not given to UMD package. #419

Open sp1rytus opened 5 years ago

sp1rytus commented 5 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => https://github.com/ngxs/store/blob/master/CONTRIBUTING.md
[x] Other... Please describe:

Current behavior

Regarding the distributed files of the npm package.

https://www.npmjs.com/package/@ngxs-labs/emitter

node_modules/@ngxs-labs/emitter/bundles/ngxs-labs-emitter.umd.js


(function (global, factory) {| (function (global, factory) {
    typeof exports === 'object' && typeof module! == 'undefined'? factory (exports, require ('@ ngxs / store'), require ('@ angular / core'), require ('rxjs / operators') typeof exports === 'object' && typeof module! == 'undefined'? factory (exports, require ('@ ngxs / store'), require ('$
    typeof define === 'function' && define.amd? define (['exports', '@ ngxs / store', '@ angular / core', 'rxjs / operators'], factory): | typeof define === 'function' && define.amd? define (['exports', '@ ngxs / store', '@ angular / core', 'rxjs / operators'] $
    (global = global || self, factory ((global ['ngxs-labs'] = global ['ngxs-labs'] || {}, global ['ngxs-labs']. emitter = {}), global. ngxs.store, global.ng.core, global.rxjs.operators)); | (global = global || self, factory ((global ['ngxs-labs'] = global ['ngxs-labs'] || { }, global ['ngxs-labs']. emitter = $
} (this, function (exports, store, core, operators) {'use strict';

The ID that recognizes package is not passed when defining with define function. For this reason, the following error occurs when launching a bundled application in Angular with AOT compilation (ngxs-labs-emitter.umd.min.js works correctly)

Current state:


define (['exports', '@ ngxs / store'...

Expected state:


define ('@ngxs-labs/emitter', ['exports', '@ ngxs / store'....

From browser console error:


Uncaught Error: Mismatched anonymous define() module: function (exports, store, core, operators) { 'use strict';

The umd file is created from the github code using the yarn emitter: build command, the ID is correctly assigned, so there may be some problem in the package upload process.

splincode commented 5 years ago

What is your moduleResolution in tsconfig.json?

sp1rytus commented 5 years ago

moduleResolution is node

I'm developing ngx app with based on Angular 8.2.14. We are developing with a template using bazel created with the following command.

ng new --collection=@angular/bazel