Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

feat: 支持运行时插件 #988

Merged
merged 2 commits into from
May 26, 2020
Merged

feat: 支持运行时插件 #988

merged 2 commits into from
May 26, 2020

Conversation

yesmeck
Copy link
Member

@yesmeck yesmeck commented May 22, 2020

@vercel
Copy link

vercel bot commented May 22, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/remaxjs/remax/f4cnbiwin
✅ Preview: https://remax-git-runtime-plugin.remaxjs.now.sh

@yesmeck yesmeck requested review from noyobo and Darmody May 22, 2020 18:28
@codesandbox-ci
Copy link

codesandbox-ci bot commented May 22, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 27b54cf:

Sandbox Source
immutable-smoke-rkeg9 Configuration

@codecov
Copy link

codecov bot commented May 23, 2020

Codecov Report

Merging #988 into master will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #988      +/-   ##
==========================================
+ Coverage   95.53%   95.60%   +0.06%     
==========================================
  Files         330      331       +1     
  Lines        3497     3526      +29     
  Branches      499      502       +3     
==========================================
+ Hits         3341     3371      +30     
+ Misses        156      155       -1     
Impacted Files Coverage Δ
packages/remax-cli/src/build/utils/alias.ts 100.00% <ø> (ø)
packages/remax-cli/src/API.ts 100.00% <100.00%> (ø)
...ackages/remax-cli/src/build/webpack/config.mini.ts 100.00% <100.00%> (ø)
packages/remax-runtime/src/PluginDriver.ts 100.00% <100.00%> (ø)
packages/remax-runtime/src/createAppConfig.ts 100.00% <100.00%> (ø)
packages/remax-runtime/src/createPageConfig.ts 100.00% <100.00%> (ø)
packages/remax-runtime/src/index.ts 100.00% <100.00%> (ø)
...ages/remax-cli/src/build/webpack/plugins/Define.ts 98.14% <0.00%> (+1.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0bc1028...27b54cf. Read the comment docs.

@@ -1,22 +1,24 @@
require('./runtime.js');
(my["webpackJsonp"] = my["webpackJsonp"] || []).push([[1],[
/* 0 */
require('./remax-vendors.js');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥这个会有变化

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onAppConfig(config) {
const onLaunch = config.onLaunch;
config.onLaunch = () => {
console.log('onLaunch');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看起来他有可能把 config 弄坏掉?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do at your own risk

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

respect

@vercel vercel bot requested a deployment to Preview May 25, 2020 04:12 Abandoned
@vercel vercel bot requested a deployment to Preview May 25, 2020 04:31 Abandoned
const pluginTemplate = fs.readFileSync(path.resolve(__dirname, '../../../template/plugin.js.ejs'), 'utf-8');
const pluginPath = winPath(
path.join(
path.resolve(path.dirname(require.resolve('@remax/runtime')), '..'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path.dirname(require.resolve('@remax/runtime/package.json')) 更简洁,也不受 main 等字段影响

Copy link
Contributor

@noyobo noyobo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Darmody
Copy link
Contributor

Darmody commented May 26, 2020

开发者要怎么给插件传参数?

@yesmeck
Copy link
Member Author

yesmeck commented May 26, 2020

webpack.DefinePlugin

@Darmody
Copy link
Contributor

Darmody commented May 26, 2020

webpack.DefinePlugin

运行时的参数呢?

@yesmeck
Copy link
Member Author

yesmeck commented May 26, 2020

就用 webpack.DefinePlugin 传进去

@juvham
Copy link
Contributor

juvham commented Aug 7, 2020

运行时插件能否给个demo。文档的信息太少了一头雾水

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[需求]运行时插件
4 participants