wmr icon indicating copy to clipboard operation
wmr copied to clipboard

Changed recommendation to use .mjs in readme.md

Open jt3k opened this issue 4 years ago • 5 comments

Because with wmr.config.mjs now results SyntaxError: Cannot use import statement outside a module

❯ mv ./wmr.config.mjs ./wmr.config.js

❯ npm run build

> @ build /Users/jt3k/work/sigma-aa/active-age/creditpotential
> wmr build --prerender

(node:49904) 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)
/Users/jt3k/work/sigma-aa/active-age/creditpotential/wmr.config.js:1
import nomodule from '@wmrjs/nomodule';
^^^^^^

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 kJe (/Users/jt3k/work/sigma-aa/active-age/creditpotential/node_modules/wmr/wmr.cjs:2:2446119)
    at async PJe (/Users/jt3k/work/sigma-aa/active-age/creditpotential/node_modules/wmr/wmr.cjs:2:2447457)

Failed to load wmr.config.js
SyntaxError: Cannot use import statement outside a module
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received an instance of URL
    at kJe (/Users/jt3k/work/sigma-aa/active-age/creditpotential/node_modules/wmr/wmr.cjs:2:2446268)
    at async PJe (/Users/jt3k/work/sigma-aa/active-age/creditpotential/node_modules/wmr/wmr.cjs:2:2447457)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ build: `wmr build --prerender`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jt3k/.npm/_logs/2021-04-29T10_10_41_649Z-debug.log

jt3k avatar Apr 29 '21 10:04 jt3k

⚠️ No Changeset found

Latest commit: 68a16978b236affe988433380a14b401f2209e72

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Apr 29 '21 10:04 changeset-bot[bot]

Hmm - doesn't the readme say that using wmr.config.js requires setting {"type":"module"} in your package.json? npm init wmr should also set that property correctly.

developit avatar Apr 29 '21 15:04 developit

The new project template does not set the module type at the moment, no.

rschristian avatar Apr 29 '21 18:04 rschristian

oh! we should change that - without "type":"module" I think prerendering breaks on Node 12.12 or something like that.

developit avatar May 03 '21 13:05 developit

#546 upped the engine req to 12.17.x. Is an issue on < 12.17 be something we'd be concerned with?

rschristian avatar May 03 '21 21:05 rschristian