lowcode-engine icon indicating copy to clipboard operation
lowcode-engine copied to clipboard

基于Webpack5或者Vite搭建是不是不太适用

Open oneQiu opened this issue 2 years ago • 24 comments

  1. Vite目前采用的是ESM的模式去开发,但是使用包都是UMD的形式引入的,并不支持,有什么解决办法吗
  2. Webpack5去构建的话也是会出现比较多的问题,感觉就只有Ice1.x版本感觉能流畅使用

oneQiu avatar Apr 07 '22 07:04 oneQiu

Hello @oneQiu. We totally like your proposal/feedback, PR wanted。

你好 @oneQiu,我们完全同意你的提议/反馈,欢迎 PR。

github-actions[bot] avatar Apr 07 '22 09:04 github-actions[bot]

这是在webpack5的情况下,还不知道如何解决的问题 image image

vite模式目前走不下去

oneQiu avatar Apr 07 '22 09:04 oneQiu

image

oneQiu avatar Apr 07 '22 09:04 oneQiu

vite 模式是解析 dependencies 而不是解析 devDependencies,按照 Demo 来应该不会有影响。

不过源码面板引入的 babel 依赖目前应该不被 vite 支持,可能需要试试 https://www.npmjs.com/package/@baleada/vite-alias-babel-runtime 之类的包?

alvarto avatar Apr 07 '22 09:04 alvarto

Webpack 5 的问题,你指的是按照这个图片配置,依然走不下去吗?

alvarto avatar Apr 07 '22 09:04 alvarto

我是直接使用了Ice2.0的vite和Vite官方去搭建,都会出现ESM模块的问题,这是VIte官方的。不知道是不是有问题 image image

oneQiu avatar Apr 07 '22 09:04 oneQiu

Webpack 5 的问题,你指的是按照这个图片配置,依然走不下去吗?

是的,依然有问题,之前一个ice1.0的旧项目就可以配置成功。但是换到ice2.0的webpack5就不行了,也是babel依赖问题。

oneQiu avatar Apr 07 '22 09:04 oneQiu

嗯 babel 的依赖我们看看能不能在后续版本迭代用 UMD 的异步 babel-standalone 替代掉。短期内方案还是用 ice 1.x 启动项目吧

alvarto avatar Apr 07 '22 10:04 alvarto

嗯 babel 的依赖我们看看能不能在后续版本迭代用 UMD 的异步 babel-standalone 替代掉。短期内方案还是用 ice 1.x 启动项目吧

重新尝试了一下,确实是@alilc/lowcode-plugin-code-editor的插件导致的问题,目前不使用这个插件可以在webpack5下成功运行,但是Vite的构建对于依然困难, image 关闭所有插件依然会有问题。可能这就是ESM下的情况吧 image

oneQiu avatar Apr 07 '22 15:04 oneQiu

ice2.x webpack5 下的@alilc/lowcode-plugin-code-editor的插件报错, 是 @babel/helper-define-polyfill-provider这个库的package.json的 exports 配置不生效, 调用了node环境的代码导致的 image 这里的node 硬改成browser即可, 应该有更好的修复方式, ice文档里没找到

smat0096 avatar Apr 20 '22 07:04 smat0096

我用vite,只想用「@alilc/lowcode-react-renderer」

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  optimizeDeps: {
    exclude: ['@alilc/lowcode-react-renderer'],
  },
});

会出现

Uncaught SyntaxError: The requested module '/node_modules/.pnpm/[email protected]/node_modules/prop-types/index.js?v=ae07ae11' does not provide an export named 'default'

的错误

xmsz avatar Jun 22 '22 06:06 xmsz

尝试使用webpack5搭建构建环境: https://github.com/BingBlog/lowcode-starter 整体上是可以运行的,prod场景下,一些优化还没加上。

目前的问题是:@alilc/lowcode-plugin-code-editor 这个插件不行。

BingBlog avatar Aug 04 '22 11:08 BingBlog

@alilc/lowcode-plugin-code-editor 已知依赖了 @babel/core 而间接依赖了 node 包,webpack 5 去掉了 node 包的 polyfill 导致跑不起来。这个月我把 babel core 替换为 babel-standalone,可以再试试。或者大家有空给 code-editor 提个 PR 我也会看的~

尝试使用webpack5搭建构建环境: https://github.com/BingBlog/lowcode-starter 整体上是可以运行的,prod场景下,一些优化还没加上。

目前的问题是:@alilc/lowcode-plugin-code-editor 这个插件不行。

alvarto avatar Aug 04 '22 11:08 alvarto

我用vite,只想用「@alilc/lowcode-react-renderer」

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  optimizeDeps: {
    exclude: ['@alilc/lowcode-react-renderer'],
  },
});

会出现

Uncaught SyntaxError: The requested module '/node_modules/.pnpm/[email protected]/node_modules/prop-types/index.js?v=ae07ae11' does not provide an export named 'default'

的错误

兄弟你用Vite跑起来了吗,我也只是用@alilc/lowcode-react-renderer

ZhelinCheng avatar Aug 15 '22 06:08 ZhelinCheng

兄弟你用Vite跑起来了吗,我也只是用@alilc/lowcode-react-renderer

我没有用过 vite,从报错来看,依赖的 prop-types 你可以用 UMD 包然后 external 掉,跳过它的打包问题。@ZhelinCheng

alvarto avatar Aug 15 '22 06:08 alvarto

@alvarto 现在出现了新的问题,试了一些方式,感觉有些棘手 image

ZhelinCheng avatar Aug 15 '22 07:08 ZhelinCheng

@ZhelinCheng 上图的这个文件是从在哪个包里面的,以及版本号又是多少。

liujuping avatar Aug 15 '22 07:08 liujuping

我用vite,只想用「@alilc/lowcode-react-renderer」

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  optimizeDeps: {
    exclude: ['@alilc/lowcode-react-renderer'],
  },
});

会出现

Uncaught SyntaxError: The requested module '/node_modules/.pnpm/[email protected]/node_modules/prop-types/index.js?v=ae07ae11' does not provide an export named 'default'

的错误

兄弟你用Vite跑起来了吗,我也只是用@alilc/lowcode-react-renderer

没有 直接放弃了 等大佬们跑通

xmsz avatar Aug 15 '22 09:08 xmsz

@liujuping 我上传上来了,https://github.com/ZhelinCheng/lowcode-test 主要是根据 @alvarto 的方法,对vite.config.js做了些处理

ZhelinCheng avatar Aug 15 '22 11:08 ZhelinCheng

@liujuping 我上传上来了,https://github.com/ZhelinCheng/lowcode-test 主要是根据 @alvarto 的方法,对vite.config.js做了些处理

not work now Screen Shot 2022-09-21 at 14 08 51

Dengyy avatar Sep 21 '22 06:09 Dengyy

我成功把官方demo改成webpack5了, 考验webpack功底的时候到了

eightHundreds avatar Nov 25 '22 09:11 eightHundreds

@eightHundreds 大佬能否给个demo,小弟搞到自闭了:(

ittat avatar Feb 23 '23 03:02 ittat

@eightHundreds 大佬能否给个demo,小弟搞到自闭了:(

这个项目的坑比改webpack5还多,建议放弃。 另外,我该用vite4了,项目比较大,热更太慢了

eightHundreds avatar Feb 23 '23 04:02 eightHundreds

那可以分享下vite的配置demo吗?我使用vite也会出现一个又一个的莫名报错

ittat avatar Feb 23 '23 06:02 ittat

@alilc/lowcode-plugin-code-editor 已知依赖了 @babel/core 而间接依赖了 node 包,webpack 5 去掉了 node 包的 polyfill 导致跑不起来。这个月我把 babel core 替换为 babel-standalone,可以再试试。或者大家有空给 code-editor 提个 PR 我也会看的~

尝试使用webpack5搭建构建环境: https://github.com/BingBlog/lowcode-starter 整体上是可以运行的,prod场景下,一些优化还没加上。 目前的问题是:@alilc/lowcode-plugin-code-editor 这个插件不行。

大佬,这个有进展吗?目前有个这样的报错 image

arleyGuoLei avatar Apr 13 '23 08:04 arleyGuoLei

@eightHundreds 大佬能否给个demo,小弟搞到自闭了:(

这个项目的坑比改webpack5还多,建议放弃。 另外,我该用vite4了,项目比较大,热更太慢了 大佬带一带,方便出一个vite的demo吗?

PineSongCN avatar Oct 12 '23 07:10 PineSongCN