typewriter-editor / typewriter

A rich text editor based off of Quill.js and Ultradom, and using Svelte for UI.
MIT License
382 stars 32 forks source link

The switch to commonjs module compilation is incompatible with "type": "module" #127

Open taylorhadden opened 1 year ago

taylorhadden commented 1 year ago

I am in the process of updating typewriter to 0.7.16 in my project. With the switch to using a commonjs output, webpack cannot import from sub-directories (e.g. import { h } from 'typewriter-editor/lib/rendering/vdom').

I was able to fix this by removing "type": "module" in package.json. Looks like typewriter needs to be a commonjs module through-and-through or the js files it produces need to be .cjs.

taylorhadden commented 1 year ago

Removing "type": "module" breaks all building scripts (obvious, in retrospect).

I was able to get importing & building to work by adding a package.json with nothing but { "type": "commonjs" } in the ./lib/ folder.

tomconnors commented 1 year ago

I was also unable to use version 0.7.16 due to this issue. 0.7.15 works.

With 0.7.16, attempts to import Typewriter's modules (in a typical Svelte + Typescript project) resulted in an error along the lines of "exports is not defined".

FluffyDiscord commented 1 year ago

The 0.7.16 is broken - I am getting Uncaught ReferenceError: exports is not defined on a clean npx create-vite project.