Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

WebChimera.js with Webpack

Sergey Radionov edited this page Aug 18, 2016 · 1 revision

In order to load node_modules/wcjs-prebuilt/bin/WebChimera.js.node, you’ll need Webpack’s node-loader – possibly this fork until the relevant pull request is merged.

Add the loader to your Webpack config. Also, Webpack can’t handle binary executable files, so you’ll need to add the WebChimera libraries to the config’s externals section.

webpack.config.js

export default {
    module: {
        loaders: [
            {
                test: /\.node$/,
                loader: 'node-loader'
            }
        ]
    },
    externals: {
        'wcjs-player': 'commonjs wcjs-player',
        'wcjs-prebuilt': 'commonjs wcjs-prebuilt'
    }
}

Also make sure to add the wcjs-prebuilt section to package.json before running npm install;

package.json

{
  "devDependencies": {
    "node-loader": "github:joerick/node-loader"
  },
  "wcjs-prebuilt": {
    "runtime": "electron",
    "runtimeVersion": "v1.3.3",
    "version": "v0.2.6"
  }
}

Hein Haraldson