DasRed / js-bbcode-parser

24 stars 7 forks source link

Typo in readme.md and type=module missing #11

Closed sunsande closed 3 years ago

sunsande commented 3 years ago

There is a typo in readme.md

// use to create a clean parser
const parserA = bbCodeParser.create{}, {})

In the package.json there is "type" = "module" missing. This causes the following error when one starts the examples from the readme.md:

node bbc.mjs
(node:23676) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
C:\project_local\js\bbc\node_modules\js-bbcode-parser\src\simple.js:1
import BBCode from './index.js';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:979:16)
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at ModuleWrap.<anonymous> (internal/modules/esm/translators.js:199:29)
    at ModuleJob.run (internal/modules/esm/module_job.js:152:23)
    at async Loader.import (internal/modules/esm/loader.js:166:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)

And actually the bbCodeParser does not have a method create.

DasRed commented 3 years ago

fixed in the next release