Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Make Cettia work with bundlers such as Webpack #14
Step 1: Copy over old code
For most of the cettia file, I just pulled the code out of that export wrapper and reindented it. I placed it in the src folder to keep it seperate from the
Step 2: Make two seperate versions for browser and node env using Babel.
In the node environment, you need to polyfill a handful of native window methods. In the browser we need to skip those polyfills. So we add
Replace env variables plugin
Remove the Dead Code! Final browser.js file does not have those lines.
Step 3: Import the correct version as needed.
FYI, you can run the corresponding server
Yeah, I didn't originally make a build step for script tags. But thats easy to add! I just updated the PR with a webpack build command to bundle another version for browsers.
So you can use:
The browser embedded version is also doing a uglify step to export a seperate cettia-browser.min.js file.
Does that take care of all of the use cases?
I've just confirmed that the fix works pretty well - http://jsbin.com/reliyunopa/edit?html,js,console
Actually, it doesn't seem to support Asynchronous Module Definition, but it's fine because I think supporting webpack is worth more than supporting AMD.
Would you mind if I squash and merge your work?
@DDKnoll If I run