Example using webpack to integrate npm module into a plugin

81 views
Skip to first unread message

Brian Theado

unread,
Jun 23, 2017, 10:05:52 PM6/23/17
to tiddly...@googlegroups.com
On the main TW list, I announced a plugin integrating the Eve language with TW
https://groups.google.com/d/msg/tiddlywiki/u46WpoCWac8/UAUdpK3ZAAAJ.

In order to get the third-party Eve npm module integrated, I used
webpack.(https://webpack.js.org/). I thought I'd point to the details
on what I did in case it is useful for anyone else, since being new to
javascript tooling, it took me a while to figure out a few of the
things.

Here is the webpack configuration file. The output.libraryTarget
section and the externals section are the two most important parts for
TW:

https://github.com/btheado/tweve/blob/master/webpack.config.js

The 'if($tw.browser)' wrapper is also important:

https://github.com/btheado/tweve/blob/master/src/plugins/btheado/tweve/tiddlywiki.files

I generated the original plugin structure using Danielo's yeoman
generator (https://groups.google.com/d/msg/tiddlywikidev/rZ8nLFKA8BE/o30NDONxAAAJ
- thanks Danielo!), but found that I couldn't get the webpack grunt
plugin to work. So I ditched the gruntfile and went completely with
npm scripts:

https://github.com/btheado/tweve/blob/master/package.json#L34

I found that much simpler but I lost some of the functionality from
the gruntfile like auto-version incrementing.

Brian

LinOnetwo

unread,
Jan 30, 2020, 2:25:15 AM1/30/20
to TiddlyWikiDev
I'm also using webpack to bundle files in  https://github.com/linonetwo/solid-tiddlywiki-syncadaptor

在 2017年6月24日星期六 UTC+8上午10:05:52,Brian Theado写道:

Mohammad

unread,
Feb 5, 2020, 4:01:54 PM2/5/20
to TiddlyWikiDev
Hi,
 Could you please give more explanation how it is possible to use your solution for syncing TW to a server over the internet?

--Mohammad
Reply all
Reply to author
Forward
0 new messages