luogu-dev / luogu-blog-frontend

Frontend Theme Packs for Luogu Blog.
GNU Affero General Public License v3.0
93 stars 28 forks source link

编译问题 #39

Closed RoderickQiu closed 5 years ago

RoderickQiu commented 5 years ago

THEME=debug yarn build 在我的环境下无法运行 yarn build THEME=debug 可以运行并且正常出结果 但其它的主题 如 yarn build THEME=ant 似乎都不行 出现:

yarn run v1.15.2 $ cross-env NODE_ENV=development webpack --progress --hide-modules --mode development THEME=ant

Insufficient number of arguments or no entry found. Alternatively, run 'webpack(-cli) --help' for usage info.

Hash: 336c2a650ea83c21a8b2 Version: webpack 4.15.1 Time: 97ms Built at: 2019-04-13 09:59:18

ERROR in Entry module not found: Error: Can't resolve 'ant' in 'C:\Users\RoderickQiu\Documents\luogu-blog-frontend' error Command failed with exit code 2. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

而并不是

yarn run v1.15.2 $ cross-env NODE_ENV=development webpack --progress --hide-modules --mode development THEME=debug Hash: f258ecdf7c82490748ad Version: webpack 4.15.1 Time: 204ms Built at: 2019-04-13 09:59:05 Asset Size Chunks Chunk Names THEME.js 52.3 KiB THEME [emitted] THEME Done in 1.81s.

buildbuild-dev 是一样的

未编译的主题在 Firefox 和 Chrome 下 localhost:3000/THEME_NAME/ 都会报错。

使用 Windows 10,在 Powershell 和 CMD 下都出错。

laosb commented 5 years ago

THEME 为环境变量而非参数,前置指定是 bash 等大多数 Linux shell 的写法。Windows 上 Powershell/CMD 命令行指定环境变量请自行搜索做法。

RoderickQiu commented 5 years ago

THEME 为环境变量而非参数,前置指定是 bash 等大多数 Linux shell 的写法。Windows 上 Powershell/CMD 命令行指定环境变量请自行搜索做法。

谢谢 解决了

但也许这点应声明在README里 毕竟有些人可能不知所措

Windows也是主流系统

moesoha commented 5 years ago

@RoderickQiu PowerShell 可使用 $env:THEME="foo" 的形式添加环境变量