@activeprospect/integration-dev-webpack 中文文档教程

发布于 3年前 浏览 10 更新于 3年前

Webpack for LeadConduit Integrations

Usage

将此作为 devDependencies 条目包含在与“丰富的 UI”的集成中。

请注意,虽然此依赖包依赖于 express,但该依赖包不在这个包的 package.json 中。 使用此包的任何集成还必须需要 express。 将它包含在这里可能会导致从集成中省略它,而在集成中必须明确要求它。 换句话说,把它留在这儿是故意的。 :-)

Conversion

将旧的集成转换为使用此:

  1. add it as a devDependencies entry in package.json
  2. remove all webpack-* dependencies from package.json
  3. change the pre-publish script (the script name "prepublishOnly" is now recommended over "prepare") in package.json from:
"prepare": "webpack --config lib/ui/webpack.config.js",

到:

"prepublishOnly": "webpack --config node_modules/@activeprospect/integration-dev-webpack/webpack.config.js",
  1. change lib/ui/index.js from:
if (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') {
  router.use(require('./webpack'));
}

...到:

if (process.env.NODE_ENV === 'development') {
  router.use(require('@activeprospect/integration-dev-webpack'));
}
  1. delete the two boilerplate webpack files:
rm lib/ui/webpack.config.js lib/ui/webpack.js

Webpack for LeadConduit Integrations

Usage

Include this as a devDependencies entry in integrations with a "rich UI".

Note that though this dependency package depends on express, that package is not in this one's package.json. Any integration that uses this package must also require express. Including it here could lead one to omit it from the integration, where it must be explictly required. In other words, leaving it out here is on purpose. :-)

Conversion

To convert old integrations to use this:

  1. add it as a devDependencies entry in package.json
  2. remove all webpack-* dependencies from package.json
  3. change the pre-publish script (the script name "prepublishOnly" is now recommended over "prepare") in package.json from:
"prepare": "webpack --config lib/ui/webpack.config.js",

to:

"prepublishOnly": "webpack --config node_modules/@activeprospect/integration-dev-webpack/webpack.config.js",
  1. change lib/ui/index.js from:
if (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') {
  router.use(require('./webpack'));
}

…to:

if (process.env.NODE_ENV === 'development') {
  router.use(require('@activeprospect/integration-dev-webpack'));
}
  1. delete the two boilerplate webpack files:
rm lib/ui/webpack.config.js lib/ui/webpack.js
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文