[英]How to package feathersjs+primus generated client js?
I am using feathersjs as restful API and primusjs as websocket connection. 我正在使用feathersjs作为restful API,使用primusjs作为websocket连接。 Below is the code I am using to generate primus.js file:
以下是我用于生成primus.js文件的代码:
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. 为了让我的客户使用生成的
primus.js
文件。 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. 但是我的客户使用webpack将每个依赖项打包到几个大的js文件中。 How can I package
primus.js
file in client if it is an auto generated file? 如果
primus.js
文件是自动生成的文件,该如何在客户端中打包?
I don't believe you can out of the box but it looks like there is a primus-webpack-plugin : 我不相信您可以开箱即用,但看起来好像有一个primus-webpack-plugin :
This plugin allows you to pass in your Primus options and then adds the client library to your Webpack build assets.
该插件允许您传递Primus选项,然后将客户端库添加到Webpack构建资产。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.