简体   繁体   中英

How to package feathersjs+primus generated client js?

I am using feathersjs as restful API and primusjs as websocket connection. Below is the code I am using to generate primus.js file:

app.configure(primus({
    transformer: 'websockets',
    timeout: false
  }, (primus) => {
    primus.library();
    primus.save(path.join(__dirname, '../public/dist/primus.js'));
  }))

In order to let my client to use the generated primus.js file. I have to serve this file from my server. From the client side, it can use it like below:

<script src='http://xxxxxx/public/dist/primus.js'>

But my client is using webpack to package every dependencies into a few big js files. How can I package primus.js file in client if it is an auto generated file?

I don't believe you can out of the box but it looks like there is a primus-webpack-plugin :

This plugin allows you to pass in your Primus options and then adds the client library to your Webpack build assets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM