import { defineConfig } from '@ice/app';
// The project config, see https://v3.ice.work/docs/guide/basic/config
// const minify = process.env.NODE_ENV === 'production' ? 'swc' : false;
export default defineConfig(() => ({
// Set your configs here.
minify: false,
server: {
onDemand: true,
format: 'esm',
},
publicPath: '/mall-view-pc',
outputDir: '../../dist/mall-view-pc'
}));
打包报错
xxx@xxxxMac-Pro cairh-mall-repo % yarn build:mall-pc
yarn run v1.22.19
$ lerna run --scope mall-pc build
lerna notice cli v4.0.0
lerna notice filter including "mall-pc"
lerna info filter [ 'mall-pc' ]
lerna info Executing command in 1 package: "yarn run build"
lerna ERR! yarn run build exited 1 in 'mall-pc'
lerna ERR! yarn run build stdout:
$ ice build
loading config...
asset js/framework.js 509 KiB [emitted] (name: framework) (id hint: framework)
asset js/140.js 432 KiB [emitted] (id hint: vendors)
asset js/407.js 135 KiB [emitted] (id hint: vendors)
asset js/main.js 28 KiB [emitted] (name: main)
asset js/p_index.js 7.94 KiB [emitted] (name: p_index)
asset favicon.ico 4.09 KiB [compared for emit] [from: public/favicon.ico] [copied]
asset js/p_test-index.js 1.26 KiB [emitted] (name: p_test-index)
asset css/p_index.css 797 bytes [emitted] (name: p_index)
asset assets-manifest.json 335 bytes [compared for emit]
asset css/main.css 199 bytes [emitted] (name: main)
webpack 5.88.2 compiled successfully in 7721 ms
Build Error Error: Cannot find module '/Users/xxx/mall-repo/node_modules/@ice/runtime/server' imported from /Users/xxx/mall-repo/dist/mall-view-pc/server/index.mjs
at new NodeError (node:internal/errors:387:5)
at finalizeResolution (node:internal/modules/esm/resolve:330:11)
at moduleResolve (node:internal/modules/esm/resolve:907:10)
at defaultResolve (node:internal/modules/esm/resolve:1115:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap. (node:internal/modules/esm/module_job:76:40)
at link (node:internal/modules/esm/module_job:75:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR! yarn run build stderr:
warning package.json: No license field
ERROR Error occurred while importing /Users/xxx/mall-repo/dist/mall-view-pc/server/index.mjs
error Command failed with exit code 1.
lerna ERR! yarn run build exited 1 in 'mall-pc'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected behavior
希望打包正常
Actual behavior
No response
Version of ice.js
@ice/app 3.49
Content of build.json or ice.config.mts
import { defineConfig } from '@ice/app';
// The project config, see https://v3.ice.work/docs/guide/basic/config
// const minify = process.env.NODE_ENV === 'production' ? 'swc' : false;
export default defineConfig(() => ({
// Set your configs here.
minify: false,
server: {
onDemand: true,
format: 'esm',
},
publicPath: '/mall-view-pc',
outputDir: '../../dist/mall-view-pc'
}));
Describe the bug
在ice.config.mts中,修改outputDir,改为相对路径
打包报错
xxx@xxxxMac-Pro cairh-mall-repo % yarn build:mall-pc yarn run v1.22.19 $ lerna run --scope mall-pc build lerna notice cli v4.0.0 lerna notice filter including "mall-pc" lerna info filter [ 'mall-pc' ] lerna info Executing command in 1 package: "yarn run build" lerna ERR! yarn run build exited 1 in 'mall-pc' lerna ERR! yarn run build stdout: $ ice build
loading config... asset js/framework.js 509 KiB [emitted] (name: framework) (id hint: framework) asset js/140.js 432 KiB [emitted] (id hint: vendors) asset js/407.js 135 KiB [emitted] (id hint: vendors) asset js/main.js 28 KiB [emitted] (name: main) asset js/p_index.js 7.94 KiB [emitted] (name: p_index) asset favicon.ico 4.09 KiB [compared for emit] [from: public/favicon.ico] [copied] asset js/p_test-index.js 1.26 KiB [emitted] (name: p_test-index) asset css/p_index.css 797 bytes [emitted] (name: p_index) asset assets-manifest.json 335 bytes [compared for emit] asset css/main.css 199 bytes [emitted] (name: main) webpack 5.88.2 compiled successfully in 7721 ms Build Error Error: Cannot find module '/Users/xxx/mall-repo/node_modules/@ice/runtime/server' imported from /Users/xxx/mall-repo/dist/mall-view-pc/server/index.mjs at new NodeError (node:internal/errors:387:5) at finalizeResolution (node:internal/modules/esm/resolve:330:11) at moduleResolve (node:internal/modules/esm/resolve:907:10) at defaultResolve (node:internal/modules/esm/resolve:1115:11) at nextResolve (node:internal/modules/esm/loader:163:28) at ESMLoader.resolve (node:internal/modules/esm/loader:841:30) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18) at ModuleWrap. (node:internal/modules/esm/module_job:76:40)
at link (node:internal/modules/esm/module_job:75:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR! yarn run build stderr:
warning package.json: No license field
ERROR Error occurred while importing /Users/xxx/mall-repo/dist/mall-view-pc/server/index.mjs
error Command failed with exit code 1. lerna ERR! yarn run build exited 1 in 'mall-pc' error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected behavior
希望打包正常
Actual behavior
No response
Version of ice.js
@ice/app 3.49
Content of build.json or ice.config.mts
Additional context
No response