-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svg import broken #515
Comments
I believe this is caused by
Proposed fix: import Svg from './Svg';
export { Svg }; Fixed in 78c3170, but may be best to revert and apply in a new atomic PR. I believe the
commonjs , but not with the es2015 module, there must be some difference in the commonjs interop polyfills compared to ES.
|
Wait I’m confused, the error is completely unrelated to the svg import. The import * as is on purpose (feature from a previous PR). And I’m not sure how this is going to fix the error |
Ah, sorry, that error seems to be caused by something else. I managed to get rid of it by aliasing And with doing this in the
it renders fine I can only find edit import { Svg } from 'react-sketchapp';
const { G, Path } = Svg; Here's the full console log (seems to be caused by [1/2] 🖨 Copied src/manifest.json in 3ms
error Error while building ./my-command.js
/Users/<redacted>/react-sketchapp/node_modules/node-gyp-build/index.js
Module not found: Error: Can't resolve 'fs' in '/Users/<redacted>/react-sketchapp/node_modules/node-gyp-build'
resolve 'fs' in '/Users/<redacted>/react-sketchapp/node_modules/node-gyp-build'
Parsed request is a module
using description file: /Users/<redacted>/react-sketchapp/node_modules/node-gyp-build/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/<redacted>/react-sketchapp/node_modules/node-gyp-build/package.json (relative path: .)
resolve as module
/Users/<redacted>/react-sketchapp/node_modules/node-gyp-build/node_modules doesn't exist or is not a directory
/Users/<redacted>/react-sketchapp/node_modules/node_modules doesn't exist or is not a directory
/Users/<redacted>/node_modules doesn't exist or is not a directory
/Users/<redacted>/node_modules doesn't exist or is not a directory
/Users/<user>/Documents/node_modules doesn't exist or is not a directory
/Users/<user>/node_modules doesn't exist or is not a directory
/Users/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /Users/<redacted>/react-sketchapp/node_modules
using description file: /Users/<redacted>/react-sketchapp/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/<redacted>/react-sketchapp/package.json (relative path: ./node_modules)
using description file: /Users/<redacted>/react-sketchapp/package.json (relative path: ./node_modules/fs)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/<redacted>/react-sketchapp/node_modules/fs doesn't exist
.sketch.js
Field 'browser' doesn't contain a valid alias configuration
/Users/<redacted>/react-sketchapp/node_modules/fs.sketch.js doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/<redacted>/react-sketchapp/node_modules/fs.js doesn't exist
as directory
/Users/<redacted>/react-sketchapp/node_modules/fs doesn't exist
looking for modules in /Users/<redacted>/github/node_modules
using description file: /Users/<redacted>/github/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/<redacted>/github/package.json (relative path: ./node_modules)
using description file: /Users/<redacted>/github/package.json (relative path: ./node_modules/fs)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/<redacted>/github/node_modules/fs doesn't exist
.sketch.js
Field 'browser' doesn't contain a valid alias configuration
/Users/<redacted>/github/node_modules/fs.sketch.js doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/<redacted>/github/node_modules/fs.js doesn't exist
as directory
/Users/<redacted>/github/node_modules/fs doesn't exist
looking for modules in /Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/node_modules
using description file: /Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/package.json (relative path: ./node_modules)
using description file: /Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/package.json (relative path: ./node_modules/fs)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/node_modules/fs doesn't exist
.sketch.js
Field 'browser' doesn't contain a valid alias configuration
/Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/node_modules/fs.sketch.js doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/node_modules/fs.js doesn't exist
as directory
/Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/node_modules/fs doesn't exist
[/Users/<redacted>/react-sketchapp/node_modules/node-gyp-build/node_modules]
[/Users/<redacted>/react-sketchapp/node_modules/node_modules]
[/Users/<redacted>/node_modules]
[/Users/<redacted>/node_modules]
[/Users/<user>/Documents/node_modules]
[/Users/<user>/node_modules]
[/Users/node_modules]
[/node_modules]
[/Users/<redacted>/react-sketchapp/node_modules/fs]
[/Users/<redacted>/github/node_modules/fs]
[/Users/<redacted>/react-sketchapp/node_modules/fs.sketch.js]
[/Users/<redacted>/github/node_modules/fs.sketch.js]
[/Users/<redacted>/react-sketchapp/node_modules/fs.js]
[/Users/<redacted>/github/node_modules/fs.js]
[/Users/<redacted>/react-sketchapp/node_modules/fs]
[/Users/<redacted>/github/node_modules/fs]
[/Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/node_modules/fs]
[/Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/node_modules/fs.sketch.js]
[/Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/node_modules/fs.js]
[/Users/<redacted>/react-sketchapp/examples/basic-svg/node_modules/@skpm/builder/node_modules/fs]
@ /Users/<redacted>/react-sketchapp/node_modules/node-gyp-build/index.js 1:9-22
@ /Users/<redacted>/react-sketchapp/node_modules/node-sketch-bridge/index.js
@ /Users/<redacted>/react-sketchapp/lib/module/platformBridges/macos.js
@ /Users/<redacted>/react-sketchapp/lib/module/index.js
@ ./src/my-command.js
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `skpm-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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/<user>/.npm/_logs/2020-05-10T08_26_54_644Z-debug.log |
So the issue is that it's trying to bundle |
Oh I think it's because of "module": "lib/module/index.js",
"sketch": "lib/module/index.sketch.js", skpm prioritize the |
Ah, great catch, adding Am still getting |
I'll fix it |
Great, thanks 🙂. I've undone the |
Seems the I just tested destructuring |
Thanks a lot, ignore my last message. Works now with Looks like using |
@mathieudutour @macintoshhelper I think the latest version does't work completely. The Svg default export was broken. I need change my code this way to get the default export(Svg itself). |
Hi, I've been running into this too (from running the
|
I am...
| -------------------------------------------------------------------------------------------------
Expected behavior:
Observed behavior:
How to reproduce:
Sketch version:
63.1
Please attach
screenshots, a zip file of your project, andor a link to your github projectThe text was updated successfully, but these errors were encountered: