Giter Club home page Giter Club logo

Comments (14)

mathieudutour avatar mathieudutour commented on June 4, 2024

yes, I fixed that when we were using rollup but switching to webpack broke it.

Can you tell me what is your use-case? I had one in mind specifically (onClick handler for react-sketchapp) but I'm curious if there is more

from skpm.

cameronmcefee avatar cameronmcefee commented on June 4, 2024

I have a handful of commands that I'm placing in the Sketch menu which are contextually similar, but call different methods (ex "Clear all guides", "Clear guides in artboard", "Clear horizontal guides", etc.) They're all effectively one liners into other methods so it seems gratuitous to put them all in their own separate files. I suppose one could argue that I make the whole thing a class and export that.

The last time I ran it, I was looking for a solution for syncing the current context with your sketch-web-view. I had two commands, one that launched the web view and one that was a listener for selection change events which would sync data into the html content of the webview. I ultimately opted for splitting them apart because they were different enough.

from skpm.

mathieudutour avatar mathieudutour commented on June 4, 2024

got it. I'll try to find a fix

from skpm.

cameronmcefee avatar cameronmcefee commented on June 4, 2024

No rush on my end. The hack works fine for me, but I figured I'd report it in case it's something you care about, and because it does make for some slightly unpredictable results.

from skpm.

mathieudutour avatar mathieudutour commented on June 4, 2024

I actually don't know how to do it. Is there any webpack expert around who have an idea?

from skpm.

cameronmcefee avatar cameronmcefee commented on June 4, 2024

For reference, here's the actual error in Console.app

ReferenceError: Can't find variable: exports.
Plugin “All artboard guides”, line 43:
» Object.defineProperty(exports, '__esModule', { value: true });

For giggles, I tried doing this:

var exports
export var foo = function (){}
export var bar = function (){}

export default function(){
  exports
}

But that gets compiled in a way that gives exports a new name so it doesn't clobber the actual exports variable, which I suppose is good behavior.

I guess the only solution I can picture is something that just prepends var exports to the file, but I'm not sure that's any better than my hack mentioned in the OP

from skpm.

mathieudutour avatar mathieudutour commented on June 4, 2024

thinking about this a bit more: would adding var exports at the top of the file with a webpack plugin (https://webpack.js.org/plugins/banner-plugin/) make it work?

from skpm.

cameronmcefee avatar cameronmcefee commented on June 4, 2024

Hmm… interesting idea. I scrapped this project in favor of a cleaner solution, but I'll try this out once I get back to this stage.

from skpm.

mathieudutour avatar mathieudutour commented on June 4, 2024

I manage to do it here: 804046e

from skpm.

rborn avatar rborn commented on June 4, 2024

I can confirm it works 👍

from skpm.

mathieudutour avatar mathieudutour commented on June 4, 2024

That was quick! Thanks

from skpm.

rborn avatar rborn commented on June 4, 2024

@mathieudutour could you please bump the version and push to npm? 🤗

from skpm.

mathieudutour avatar mathieudutour commented on June 4, 2024

It's a breaking change, I'd like to get #44 in as well, and maybe fixing #45 before releasing

from skpm.

rborn avatar rborn commented on June 4, 2024

Ok, I can live with the github version, thanks!

from skpm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.