Skip to content

[Bug]: project build asset import path error #527

@shimingw

Description

@shimingw

Version

none

Details

package.json

{
  "name": "xxx",
  "version": "1.0.0-bate.4",
  "type": "module",
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.js"
    }
  },
  "module": "./dist/index.js",
  "types": "./dist/index.d.ts",
  "files": [
    "dist"
  ],
  "scripts": {
    "build": "rslib build",
    "build:storybook": "storybook build",
    "dev": "rslib build --watch",
    "format": "prettier --write .",
    "lint": "eslint .",
    "storybook": "storybook dev",
    "test": "vitest run",
    "lint:ts": "npx tsc --noEmit"
  },
  "devDependencies": {
    "@eslint/js": "^9.12.0",
    "@rsbuild/core": "1.1.7",
    "@rsbuild/plugin-less": "^1.1.0",
    "@rsbuild/plugin-react": "^1.0.7",
    "@rslib/core": "^0.1.2",
    "@storybook/addon-essentials": "^8.4.5",
    "@storybook/addon-interactions": "^8.4.5",
    "@storybook/addon-links": "^8.4.5",
    "@storybook/addon-onboarding": "^8.4.5",
    "@storybook/blocks": "^8.4.5",
    "@storybook/react": "^8.4.5",
    "@storybook/test": "^8.4.5",
    "@testing-library/jest-dom": "^6.6.3",
    "@testing-library/react": "^16.0.1",
    "@types/lodash": "^4.17.13",
    "@types/react": "^18.3.12",
    "eslint": "^9.12.0",
    "globals": "^15.11.0",
    "jsdom": "^25.0.1",
    "prettier": "^3.3.3",
    "react": "^18.3.1",
    "storybook": "^8.4.5",
    "storybook-addon-rslib": "^0.1.5",
    "storybook-react-rsbuild": "^0.1.5",
    "typescript": "^5.6.3",
    "typescript-eslint": "^8.8.1",
    "vitest": "^2.1.6"
  },
  "peerDependencies": {    
"lodash": ">=4.17.0",
    "react": ">=16.9.0",
    "react-dom": ">=16.9.0"
  },
  "dependencies": {
    "react-viewer": "^3.2.2"
  },
  "resolutions": {
    "react-dom": "18.3.1"
  }
}

rsconfig

import { pluginReact } from '@rsbuild/plugin-react';
import { defineConfig } from '@rslib/core';
import { pluginLess } from '@rsbuild/plugin-less';

export default defineConfig({
  source: {
    entry: {
      index: ['./src/**'],
    },
  },
  lib: [
    {
      bundle: false,
      dts: true,
      format: 'esm',
    },
  ],
  output: {
    target: 'web',
  },
  plugins: [
    pluginLess(),
    pluginReact({
      swcReactOptions: {
        runtime: 'classic',
      },
    }),
  ],
});

error assets examle
Image

Reproduce link

none

Reproduce Steps

none

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions