question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Refactor] Replace Browserify with Parcel

See original GitHub issue

I’m currently experimenting with the idea of refactoring canvas-sketch and its CLI tools to use Parcel instead of Browserify under the hood. I’m happy to hear any thoughts about this.

Enhancements that will be part of this refactor:

  • A more powerful bundler that can handle ES6, CSS, importing PNG assets, and other features that aren’t supported right now.
  • An elegant API for using canvas-sketch programmatically, whether as a pure bundler or as a development server.
  • Much easier to build an Electron-based wrapper on top of canvas-sketch
  • True hot module replacement (this will have a different UX/flow than the current --hot flag, but will be more robust)
  • Faster builds and reloads

It will be a major breaking change.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:15
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
lutzercommented, Nov 11, 2019

So Im a little confused… Is it possible with the current canvas-sketch-cli to use es6 import/export syntax to include modules? And if so, how do i do it? I would like to include threejs jsm packages instead of appending them all manually to the global THREE variable… if i try that it tells me ParseError: 'import' and 'export' may appear only with 'sourceType: module'

2reactions
mattdeslcommented, Jul 1, 2019

@Greyvy Yes this will be a breaking change. In my own repo of sketches I use canvas-sketch-cli locally, so that each commit is locked to a specific version of canvas sketch CLI:

# in your repo, install the tool locally
npm install canvas-sketch-cli --save-dev

# run with 'npx' to make sure you get the local CLI
npx canvas-sketch sketches/foo.js

This way I can go back to a commit, delete node_modules and npm install again and I will be on the same version of the CLI that was used along with the sketches in that commit.

Yes it would be able to handle import syntax, although I will probably stick with require() in the docs for parity with Node.js (Parcel supports that too).

@ogrodnek Yup TypeScript will work as Parcel supports that out of the box. FWIW you can already use TypeScript with canvas-sketch as in this gist, but you may need to update your dependencies on canvas-sketch and canvas-sketch-cli for it to work:

https://gist.github.com/mattdesl/1e9ab019534838e8c870ae06371be469

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - [Refactor] Replace Browserify with Parcel -
[Refactor] Replace Browserify with Parcel. ... I'm currently experimenting with the idea of refactoring canvas-sketch and its CLI tools to use Parcel ...
Read more >
What are some alternatives to Browserify? - StackShare
Bower. Bower is a package manager for the web. · Webpack. A bundler for javascript and friends. · Babel · rollup · RequireJS...
Read more >
Parcel – A fast, zero configuration web application bundler
Webpack actually does the same (it's module bundler), browserify ... to completely refactor it every time a new build tool is adapted ;-) ......
Read more >
Comparison of Build Tools - SurviveJS
Browserify is one solution to the module problem. It allows CommonJS modules to be bundled together. You can hook it up with Gulp,...
Read more >
browserify-ftw - npm Package Health Analysis - Snyk
Upgrade your app from requireJS AMD to commonJS module format via an automated refactor step in order to browserify it. For more information...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found