Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复 build 下 端口校验 & 抽离 @kkt/ssr 下 plugin 文件 & 整洁代码 #28

Merged
merged 167 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
fc19528
feat:新增 @kkt/plugin-ssr
SunLxy Feb 28, 2022
e122892
chore:修改部分配置
SunLxy Mar 1, 2022
5d5f0c3
feat:新增第二种ssr-plugin方案
SunLxy Mar 2, 2022
47f3643
fix:子程序去除MiniCssExtractPlugin module和plugin
SunLxy Mar 3, 2022
047747b
fix:整理 代码
SunLxy Mar 3, 2022
a078c59
fix:修改配置
SunLxy Mar 3, 2022
d1479f0
fix:暂时处理css的sourceMap
SunLxy Mar 3, 2022
dfaeb9b
fix:先删除其他demo
SunLxy Mar 4, 2022
f16eae4
fix:插件直接运行一个webpack可以打包了
SunLxy Mar 5, 2022
6b053d1
feat:添加 @kkt/ssr-ncc
SunLxy Mar 6, 2022
10a3f55
fix:整理文件
SunLxy Mar 6, 2022
41fc8b7
fix:修改log提示
SunLxy Mar 6, 2022
ebf5dbe
feat:完善
SunLxy Mar 6, 2022
089be6e
fix:简化代码
SunLxy Mar 6, 2022
7cc3822
style:注释
SunLxy Mar 6, 2022
62d4707
feat:完善 ssr plugin 插件
SunLxy Mar 7, 2022
31c8d38
feat:添加 plugins demo
SunLxy Mar 7, 2022
b5ba4ab
doc:更新文档
SunLxy Mar 7, 2022
819eacd
fix:修改 plugins 打包 报错
SunLxy Mar 7, 2022
1daf1f2
feat:优化 plugin 代码
SunLxy Mar 7, 2022
512231d
delete:删除无用代码
SunLxy Mar 7, 2022
305f75a
feat:ci脚本
SunLxy Mar 7, 2022
b96d83f
fix:文件清空问题
SunLxy Mar 7, 2022
4893f9c
fix: sourceMap 配置
SunLxy Mar 7, 2022
741d1a7
feat:添加一个define变量
SunLxy Mar 7, 2022
0f72133
released v3.0.0
SunLxy Mar 7, 2022
d575ca8
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 7, 2022
57cdaac
delete:删除文件
SunLxy Mar 7, 2022
16eb826
delete:package-lock.json
SunLxy Mar 7, 2022
d5d14f6
feat:简单加一个 router 跳转的demo
SunLxy Mar 7, 2022
386c0e8
fix:路由渲染
SunLxy Mar 7, 2022
3e97159
fix:修改 开发模式下不需要 进行操作文件
SunLxy Mar 7, 2022
19a1f0a
feat:暂时写一个快捷生成项目的create-kkt-ssr
SunLxy Mar 7, 2022
30747fd
delete:删除无用代码
SunLxy Mar 8, 2022
2ac44fa
fix:服务端代码分割问题
SunLxy Mar 8, 2022
b366132
feat: 状态获取 demo
SunLxy Mar 8, 2022
9546cab
feat:对WebpackManifestPlugin插件生成的 asset-manifest.json 内容进行覆写
SunLxy Mar 8, 2022
e46f179
feat:新增 老版 react-router-rematch 案例
SunLxy Mar 8, 2022
867d49f
update:ci脚本
SunLxy Mar 8, 2022
9104dc6
released v3.0.1
SunLxy Mar 8, 2022
146bf60
script:修改命令
SunLxy Mar 8, 2022
ac93dfb
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 8, 2022
5c61a89
chore:更新案例react-content-loader包的版本
SunLxy Mar 8, 2022
0696349
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 8, 2022
a207f1d
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 8, 2022
00c9b39
doc:更新文档
SunLxy Mar 8, 2022
206b622
update:新增 zip ci
SunLxy Mar 8, 2022
95bf30c
update:ci
SunLxy Mar 8, 2022
581cc0c
update:ci
SunLxy Mar 8, 2022
6296d52
update:ci
SunLxy Mar 8, 2022
3a7ac3d
update:ci
SunLxy Mar 8, 2022
4735ecf
update:ci
SunLxy Mar 8, 2022
2bed730
update:ci
SunLxy Mar 8, 2022
d8786af
update:ci
SunLxy Mar 8, 2022
2b787c1
update:ci
SunLxy Mar 8, 2022
ba0e6d6
update:ci
SunLxy Mar 8, 2022
615f99b
update:ci
SunLxy Mar 8, 2022
28f56e3
update:ci
SunLxy Mar 8, 2022
d503e71
chore:管理依赖版本
SunLxy Mar 8, 2022
de4b37a
doc:更新文档
SunLxy Mar 9, 2022
041b98b
delete:删除无用代码
SunLxy Mar 9, 2022
6569830
doc:更新文档
SunLxy Mar 9, 2022
7530923
feat:使用 router v6 重构 react-ssr-enhanced
SunLxy Mar 9, 2022
38f0e21
fix:修改 @kkt/react-ssr-enhanced 包状态
SunLxy Mar 9, 2022
af476d0
question: @kkt/react-ssr-enhanced 剩余问题
SunLxy Mar 9, 2022
1bf612e
style:删除注释
SunLxy Mar 10, 2022
e52f213
fix:修改 models 报错
SunLxy Mar 10, 2022
a0d69e6
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 10, 2022
89ba625
fix:暂时解决 window 变量问题
SunLxy Mar 10, 2022
07c8873
fix:懒加载问题
SunLxy Mar 10, 2022
44ef372
released v3.0.2
SunLxy Mar 10, 2022
c384b9e
style:注释内容
SunLxy Mar 10, 2022
2fee19f
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 10, 2022
2061c3f
fix:修复 ico 图标问题
SunLxy Mar 10, 2022
9c4b83d
fix:修改 开发模式 下报错
SunLxy Mar 10, 2022
eb885dd
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 10, 2022
2931da0
fix:修改 开发模式下 ico 图标问题
SunLxy Mar 10, 2022
9b7b936
feat:二次对@kkt/ssr 进行改造 使其一次可以执行多配置
SunLxy Mar 15, 2022
80c4a76
feat: build 打印
SunLxy Mar 15, 2022
3bb40a7
fix:自定义配置加载方式,修改 build 代码
SunLxy Mar 16, 2022
54a392e
script:修改案例命令
SunLxy Mar 16, 2022
4648ec5
doc:更新文档
SunLxy Mar 16, 2022
1d01d23
fix:修改help提示
SunLxy Mar 16, 2022
80cd3dc
script:修改案例script
SunLxy Mar 16, 2022
7816223
fix:修改配置
SunLxy Mar 16, 2022
0551244
doc:更新文档
SunLxy Mar 16, 2022
779a13a
fix:加载自定义配置问题
SunLxy Mar 16, 2022
712a349
feat:新增命令行 控制是否添加 webpackNodeExternals
SunLxy Mar 16, 2022
080bd1a
feat: 增加 Args 参数
SunLxy Mar 16, 2022
b79895a
fix:判断文件入口是否存在进行添加webpack config
SunLxy Mar 16, 2022
6f83c26
released v3.1.0
SunLxy Mar 16, 2022
49caf08
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 16, 2022
edefdf9
fix:修改 paths 引用
SunLxy Mar 16, 2022
7b70012
fix:修改代码分割判断
SunLxy Mar 17, 2022
6c93b4e
fix:修改 watch 获取 webpack 配置模式,解决css问题
SunLxy Mar 17, 2022
6010b36
fix:修改开发模式下 css 服务端 加载问题
SunLxy Mar 17, 2022
204afa1
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 17, 2022
fa2a7bc
feat:内置 less 处理
SunLxy Mar 17, 2022
20b038d
fix:去除 less 处理
SunLxy Mar 18, 2022
084cbf9
refactor(@kkt/plugin-less):重构
SunLxy Mar 18, 2022
3cdce1e
fix:修改加载问题
SunLxy Mar 18, 2022
8ec6b84
update(ci):更新
SunLxy Mar 18, 2022
ebaa693
released v3.1.1
SunLxy Mar 18, 2022
d4945f9
fix(@kkt/plugin-less ): sourceMap 问题
SunLxy Mar 18, 2022
0789043
fix:开发模式下页面样式问题
SunLxy Mar 18, 2022
863a985
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 18, 2022
0984108
released v3.1.2
SunLxy Mar 18, 2022
274e2ea
update:更新script配置
SunLxy Mar 18, 2022
81ec8a3
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 18, 2022
4db937a
fix: less-loader 规则位置问题
SunLxy Mar 18, 2022
a3f47b8
fix:less 服务端className 名称问题
SunLxy Mar 19, 2022
6dcc538
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 19, 2022
15795c3
fix:更改ci
SunLxy Mar 19, 2022
0dc7d6c
fix:修改 less/css 加载问题
SunLxy Mar 19, 2022
d31df77
relesaed v3.1.3
SunLxy Mar 19, 2022
80f5c2d
fix(@kkt/ssr):css 重置参数名称问题
SunLxy Mar 19, 2022
cb6af1e
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 19, 2022
b90a2d1
fix(@kkt/react-ssr-enhanced):修复页面二次刷新 数据预获取
SunLxy Mar 21, 2022
ebaa176
feat(@kkt/ssr):新增 proxySetup 功能
SunLxy Mar 21, 2022
232e102
released v3.1.4
SunLxy Mar 21, 2022
8bde9a7
ci:更新ci
SunLxy Mar 21, 2022
4d994d9
feat(@kkt/ssr):自动启动服务
SunLxy Mar 21, 2022
d808db7
feat:start命令生成 server 文件 和 client 端 assets文件
SunLxy Mar 22, 2022
d213df6
fix(@kkt/react-ssr-enhanced):修复build后页面空白问题
SunLxy Mar 22, 2022
65d8b31
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 22, 2022
f10feb9
fix:修复 运行 start 之后关闭后 重新运行 watch 报错
SunLxy Mar 22, 2022
83ce659
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 22, 2022
9656da4
style:注释说明
SunLxy Mar 22, 2022
9f8d908
fix:修复路由配置中element为dom标签是获取不到 获取预加载数据的方法
SunLxy Mar 22, 2022
8949836
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 22, 2022
94c4691
released v3.1.5
SunLxy Mar 22, 2022
0e1a4be
released v3.1.5
SunLxy Mar 22, 2022
252a182
Merge branch 'master' of github.com:SunLxy/kkt-ssr
SunLxy Mar 22, 2022
20fc0ad
fix:修改 asset 文件生成少前面的 /
SunLxy Mar 22, 2022
df7bc4c
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 22, 2022
22300a7
chore:修复依赖
SunLxy Mar 22, 2022
6cbc5be
feat(@kkt/ssr): 移除 webpack 配置中 source-map-loader
SunLxy Mar 23, 2022
c048a02
fix(@kkt/plugin-less):修复 getLocalIdent 值
SunLxy Mar 23, 2022
dd2537f
doc:更新文档
SunLxy Mar 23, 2022
16be4ab
feat(@kkt/react-ssr-enhanced):新增传递 match 参数
SunLxy Mar 23, 2022
3d534a0
released v3.1.6
SunLxy Mar 23, 2022
a0734d0
doc:更新文档
SunLxy Mar 23, 2022
713f09e
chore:删除不需要的依赖
SunLxy Mar 23, 2022
e65e768
chore:依赖更新
SunLxy Mar 23, 2022
401d3a1
feat:新增 命令参数 控制客户端是否不使用内置的处理配置方法
SunLxy Mar 23, 2022
eaa8937
fix(@kkt/ssr):修复 Conflicting values for 'process.env.PUBLIC_URL'
SunLxy Mar 23, 2022
4deef29
style:注释
SunLxy Mar 23, 2022
d0cffd3
feat:新增 overridesCommonWebpack 配置参数
SunLxy Mar 24, 2022
3211215
feat:新增 minify 参数
SunLxy Mar 24, 2022
348d763
feat(@kkt/ssr): 新增 DefinePlugin 变量 HOSTAPI 值
SunLxy Mar 24, 2022
cdd88ee
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 24, 2022
2f1fa69
feat(@kkt/ssr): 新增 process.env.HOSTAPI 变量
SunLxy Mar 24, 2022
d0147fd
released v3.1.7
SunLxy Mar 24, 2022
c7d332a
style:修改案例配置
SunLxy Mar 24, 2022
689d62b
fix:修改useMatch
SunLxy Mar 24, 2022
ed3df10
style:整理文件
SunLxy Mar 25, 2022
1e5952b
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 25, 2022
7320f22
fix(@kkt/plugin-less):修复 图片 url 地址问题
SunLxy Mar 25, 2022
02ab3c5
released v3.1.8
SunLxy Mar 25, 2022
58f177d
fix(@kkt/ssr): 去除 build 情况下 PORT 校验
SunLxy Mar 25, 2022
531575c
move(@kkt/ssr/plugin):把@kkt/ssr/plugin 抽离成包
SunLxy Mar 25, 2022
0acab73
fix:修改案例
SunLxy Mar 25, 2022
41ae31a
clean:删除 @kkt/ssr 下 plugin 文件夹
SunLxy Mar 25, 2022
67edec3
doc:更新文档
SunLxy Mar 25, 2022
cd31e83
Merge branch 'master' of github.com:kktjs/kkt-ssr
SunLxy Mar 25, 2022
cb25119
style:整理文件
SunLxy Mar 28, 2022
733db13
style:整理代码
SunLxy Mar 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,19 @@ To debug the node server, you can use `react-ssr start --inspect-brk`. This will
You can use plug-ins, taking KKT as an example
Add `.kktrc.js` to the root directory of your project

**use SSRWebpackRunPlugin**

```js
import { restWebpackManifestPlugin, getRemoveHtmlTemp, SSRWebpackRunPlugin } from '@kkt/ssr/lib/plugins';

export default (conf, evn) => {
// client ,
if (!options.bundle) {
conf.plugins.push(new SSRWebpackRunPlugin());
conf.plugins = getRemoveHtmlTemp(conf.plugins)
conf = restWebpackManifestPlugin(conf);
}
conf.module.exprContextCritical = false;
return conf;
import pluginLess from "@kkt/plugin-less"

export default {
overridesCommonWebpack: (conf, env, options) => {
const newConfig = pluginLess(conf, {
target: conf.target==="node14"?"node":"web",
env,
paths: options.paths
})
return newConfig
},
};

```
Expand Down
34 changes: 11 additions & 23 deletions core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,6 @@ interface SSRNCCArgs extends BuildArgs {
}

(async () => {
/**
* --- 目标
* 1. 入口文件
* 2. 出口文件
* 3. 输出文件夹
* 4. ts 还是 js
* 5. sourceMap = false
* 6. 进行 全量打包 还是使用 require 引入
* css 文件抽离不需要打包到 server.js 中 ,或者使用 [isomorphic-style-loader](https://www.npmjs.com/package/isomorphic-style-loader) 进行转换
* */

/** 二次改造
* 1. 支持多配置一起执行
* 2. 只保留 build 和 watch 功能,
* 3. 简化代码 和 配置
* **/

try {
const args = process.argv.slice(2);
Expand Down Expand Up @@ -114,25 +98,29 @@ interface SSRNCCArgs extends BuildArgs {
process.env.PUBLIC_URL = '';
}

const setEnv = (NODE_ENV: "production" | "development") => {
process.env.BABEL_ENV = NODE_ENV;
process.env.NODE_ENV = NODE_ENV;
}

if (scriptName === 'build') {
process.env.BABEL_ENV = 'production';
process.env.NODE_ENV = 'production';
setEnv("production")

const build = await import("./script/build")
await build.default(options)
} else if (scriptName === 'watch') {

process.env.BABEL_ENV = 'development';
process.env.NODE_ENV = 'development';
} else if (scriptName === 'watch') {

setEnv("development")
const watch = await import("./script/watch")
await watch.default(options)

} else if (scriptName === 'start') {
process.env.BABEL_ENV = 'development';
process.env.NODE_ENV = 'development';

setEnv("development")
const start = await import("./script/start")
await start.default(options)

}
} catch (error) {
console.log('\x1b[31m KKT:SSR:ERROR:\x1b[0m', error);
Expand Down
3 changes: 0 additions & 3 deletions core/src/plugins/index.ts

This file was deleted.

93 changes: 0 additions & 93 deletions core/src/plugins/utils/module.ts

This file was deleted.

24 changes: 0 additions & 24 deletions core/src/plugins/utils/paths.ts

This file was deleted.

115 changes: 0 additions & 115 deletions core/src/plugins/utils/plugins.ts

This file was deleted.

Loading