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

Build error after upgrade to 1.0.0 #1

Closed
hustcer opened this issue Jul 7, 2024 · 3 comments
Closed

Build error after upgrade to 1.0.0 #1

hustcer opened this issue Jul 7, 2024 · 3 comments

Comments

@hustcer
Copy link

hustcer commented Jul 7, 2024

rsbuild config:

import { defineConfig } from '@rsbuild/core';
import { pluginUmd } from '@rsbuild/plugin-umd';
import { pluginSass } from '@rsbuild/plugin-sass';
import { pluginLess } from '@rsbuild/plugin-less';
import { pluginReact } from '@rsbuild/plugin-react';

import { DEFINE } from '../../../env.mjs';

const PKG_NAME = 'abc';
const INDEX_FILE = './view/index.jsx';

export default defineConfig({
  source: {
    define: DEFINE,
    entry: {
      index: INDEX_FILE,
    },
  },
  output: {
    sourceMap: {
      js: 'source-map',
    },
    polyfill: 'usage',
    // 默认情况下,Rsbuild 会把 CSS 提取为独立的 .css 文件,并输出到构建产物目录。
    // 设置该选项为 true 后,CSS 文件会被内联到 JS 文件中,并在运行时通过 <style> 标签插入到页面上
    injectStyles: true,
    cleanDistPath: true,
    distPath: {
      root: './build',
      js: 'view',
      css: 'view',
    },
    filename: {
      js: 'index.js',
    },
  },
  tools: {
    bundlerChain: (chain) => {
      chain.ignoreWarnings([/Using \/ for division outside of calc()/]);
    },
  },
  plugins: [pluginReact(), pluginSass(), pluginLess(), pluginUmd({ name: PKG_NAME })],
});

Works fine with 0.7.10, however, after upgrading to v1.0.0 got the following error:

  Rsbuild v1.0.0

warn    Rsbuild plugin "rsbuild:sass" registered multiple times.
warn    Rsbuild plugin "rsbuild:less" registered multiple times.
error   Failed to build, please check logs.
error   Cannot access Rsbuild config until modifyRsbuildConfig is called.
    at Object.getRsbuildConfig (/Users/hustcer/github/terminus/asrm-ui/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/rspack-provider/core/initPlugins.js:34:13)
    at /Users/hustcer/github/terminus/asrm-ui/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@rsbuild/plugin-umd/dist/index.cjs:32:30
    at Object.call (/Users/hustcer/github/terminus/asrm-ui/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/shared/dist/createHook.js:32:28)
    at async modifyRsbuildConfig (/Users/hustcer/github/terminus/asrm-ui/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/rspack-provider/core/initConfigs.js:31:22)
    at async initConfigs (/Users/hustcer/github/terminus/asrm-ui/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/rspack-provider/core/initConfigs.js:47:3)
    at async build (/Users/hustcer/github/terminus/asrm-ui/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/rspack-provider/core/build.js:52:31)
    at async Command.<anonymous> (/Users/hustcer/github/terminus/asrm-ui/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/cli/commands.js:87:7)
 ELIFECYCLE  Command failed with exit code 1.

rsbuild and plugin versions:

    "@rsbuild/core": "^1.0.0-alpha.5",
    "@rsbuild/plugin-less": "^1.0.0-alpha.5",
    "@rsbuild/plugin-node-polyfill": "^1.0.1",
    "@rsbuild/plugin-react": "^1.0.0-alpha.5",
    "@rsbuild/plugin-sass": "^1.0.0-alpha.5",
    "@rsbuild/plugin-umd": "^1.0.0",
@hustcer
Copy link
Author

hustcer commented Jul 7, 2024

BTW: Why it told me that:

warn    Rsbuild plugin "rsbuild:sass" registered multiple times.
warn    Rsbuild plugin "rsbuild:less" registered multiple times.

Obviously, I have just registered once.

@chenjiahan
Copy link
Member

Hi, you can change "^1.0.0-alpha.5" to "1.0.0-alpha.5"

If we use ^1.0.0-alpha.5, the package manager will resolve to @rsbuild/[email protected], which is a deprecated version.

@hustcer
Copy link
Author

hustcer commented Jul 7, 2024

Thanks for the quick reply, works now

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

No branches or pull requests

2 participants