Tangerine-Community / tangy-form

<tangy-form> is a web component for creating multipage forms. Other <tangy-*> input elements are included as well.
GNU General Public License v3.0
15 stars 3 forks source link

Enable this lib to work with es6 support in node #231

Closed chrisekelley closed 3 years ago

chrisekelley commented 3 years ago

2 things to do:

In the pouchdb-couchdb-transform-cli add-dryRun-and-console-output branch, when running a script it is unable to find imports from tangy-form. Specifically, my version of the cli is importing helpers.js.

for example: node_modules/tangy-form/helpers.js and change import { TangyFormResponseModel } from './tangy-form-response-model' to import { TangyFormResponseModel } from './tangy-form-response-model.js'

But will this make tangy-form lib not work in non-node apps like Tangerine client?

In run-batch-es6 i'm importing helpers.js like this:

import * as pkg from 'tangy-form/helpers.js';
// console.log(pkg.Get)
const { Get } = pkg.Get;
chrisekelley commented 3 years ago

If I change my import to

import Get from 'tangy-form';

I get the following error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 
'/home/ubuntu/pouchdb-couchdb-transform-cli/node_modules/tangy-form/tangy-form-response-model' 
imported from /home/ubuntu/pouchdb-couchdb-transform-cli/node_modules/tangy-form/helpers.js\n" +
chrisekelley commented 3 years ago

I see how adding .js to imports within tangy-form could confuse the ts interpreter - but maybe the --es-module-specifier-resolution=node switch as commented upon in this answer might help.

chrisekelley commented 3 years ago

This comment further illustrates the issue and solution I tried - which worked (adding .js to imports) but I still wonder how this will work in Tangerine client.