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

ice3.js outputDir异常 #6916

Open
wh1teYu opened this issue Jun 19, 2024 · 1 comment
Open

ice3.js outputDir异常 #6916

wh1teYu opened this issue Jun 19, 2024 · 1 comment
Assignees
Labels

Comments

@wh1teYu
Copy link

wh1teYu commented Jun 19, 2024

Describe the bug

在ice.config.mts中,修改outputDir,改为相对路径

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'
}));

Additional context

No response

@wh1teYu wh1teYu added the bug label Jun 19, 2024
@ClarkXia ClarkXia self-assigned this Jun 19, 2024
@ClarkXia
Copy link
Collaborator

产物最好还是在项目目录下,如果涉及最终移动位置的诉求,可以通过结束构建的 hooks 进行拷贝操作

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

No branches or pull requests

2 participants