You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ node test.mjs
file:///D:/wamp/www/pcui/test.mjs:1
import { Label } from './dist/pcui.js';
^^^^^
SyntaxError: Named export 'Label' not found. The requested module './dist/pcui.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from './dist/pcui.js';
const { Label } = pkg;
at ModuleJob._instantiate (internal/modules/esm/module_job.js:104:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:149:5)
at async Loader.import (internal/modules/esm/loader.js:166:24)
at async Object.loadESM (internal/process/esm_loader.js:68:5)
Doing what node suggests may work, but the library clearly needs to access window so it fails at that point instead. I didn't expect PCUI to work in node of course, but I did expect the module to import successfully, but alas it didn't
Expected behavior
The component to be found :)
Desktop (please complete the following information):
OS: Windows 10
Browser n/a
Any ideas?!
I've attached the pcui dist files that npm run build created in case that helps.
Hi @photonstorm , i've created a PR which updates our webpack config to handle an esm build of PCUI. You can use the .mjs files it outputs to use the module syntax you were expecting.
I'm also updating the readme to reflect that. Thanks for bringing this to our attention!
Describe the bug
Have built PCUI but cannot import anything from the dist build.
To Reproduce
Steps to reproduce the behavior:
npm install
(was successful)npm run build
(was successful)I tried a simple script:
And get:
Uncaught SyntaxError: The requested module './dist/pcui.js' does not provide an export named 'Label'
I also tried from an HTML page:
And got the same result.
Finally, I also tried from node (test.mjs):
and get this:
Doing what node suggests may work, but the library clearly needs to access
window
so it fails at that point instead. I didn't expect PCUI to work in node of course, but I did expect the module to import successfully, but alas it didn'tExpected behavior
The component to be found :)
Desktop (please complete the following information):
Any ideas?!
I've attached the pcui dist files that
npm run build
created in case that helps.dist.zip
The text was updated successfully, but these errors were encountered: