UNPKG

webworkify-webpack2

Version:

launch a web worker that can require() in the browser with webpack, compatible with webworkify

44 lines (29 loc) 1.33 kB
# webworkify-webpack2 Launch a web worker that can `require()` in the browser with webpack 2. This fork of [webworkify-webpack](https://github.com/borisirota/webworkify-webpack) should **only** be used as an alias for original [webworkify](https://github.com/substack/webworkify) with webpack 2. It lets libraries that has webworkify dependency to be used with webpack 2 (e.g. [videojs-contrib-hls](https://github.com/videojs/videojs-contrib-hls)). ## how to use First, replace `webworkify` with `webworkify-webpack2` by creating an alias in your webpack config: ``` resolve: { alias: { webworkify: 'webworkify-webpack2' } } ``` Then use the library you are trying to integrate as you would normally do: ```js import 'videojs-contrib-hls'; ``` ## install With [npm](https://npmjs.org) do: ```sh npm install webworkify-webpack2 --save ``` ## caveats * While developing make sure not to set webpack's devtool option to be with some eval configuration because from 1.1.0 version it won't work - check [#7](https://github.com/borisirota/webworkify-webpack/pull/7) * When passing anonymous functions to webworkify-webpack2, naming them can prevent potential issues - [#9](https://github.com/borisirota/webworkify-webpack/issues/9), [#10](https://github.com/borisirota/webworkify-webpack/issues/10) ## license MIT