mam_mol
mam_mol copied to clipboard
this.$ в корне бандла
rollup ругается на this is undefined при попытке использовать в нем собранный mam-ом бандл. https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
Собираю из этого исходника https://github.com/zerkalica/mol-react-examples/tree/master/nxr/atom
Потом приходится править руками и убирать this.
Пример приложения: https://github.com/zerkalica/mol-react-examples/
Избавился от this.
Не до конца избавился, в корне остается еще this && this.__decorate https://github.com/zerkalica/mol-react-examples
src/index.js → docs/examples/app.js...
(!) `this` has been rewritten to `undefined`
https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
src/nxr/atom/-/web.js
685: "use strict";
686:
687: var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
^
688: var c = arguments.length,
689: r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
...and 1 other occurrence
(!) Import of non-existent export
src/index.js
3: var _dec, _class;
4:
5: import { ReactAtom } from './nxr/atom/-/web';
^
6: import { createConnect } from 'urc';
7: import { h, render, Component } from 'preact';
Всё-таки надо свою реализацию этих функций вкорячить. Заодно и от их дублирования избавлюсь.
Сейчас используется своя реализация: https://github.com/hyoo-ru/mam_mol/blob/32a535705546d19ebd380b3b1a5be1985aa243fd/mol.jam.js#L3
Надо разобраться как поправить, чтобы rollup не ругался.
(typeof this !== 'undefined' && this...
- не проканает?
Не, ему, емнип, именно слово this не нравится в глобальном скоупе. В рантайме-то с ним всё в порядке.