vagran / dxf-viewer

DXF 2D viewer written in JavaScript
Mozilla Public License 2.0
290 stars 86 forks source link

Add "type: module" to `package.json` #90

Closed szrharrison closed 5 months ago

szrharrison commented 8 months ago

so imported files are loaded correctly.

This should help avoid errors like the following, by telling node that the files don't use the cjs syntax for importing and exporting:

export {DxfFetcher} from "./DxfFetcher"
^^^^^^

SyntaxError: Unexpected token 'export'
    at compileFunction (<anonymous>)
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1032:15)
    at Module._compile (node:internal/modules/cjs/loader:1067:27)

See the node.js docs for more info on using esm in node libraries.