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

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

Closed
shimingw opened this issue Dec 5, 2024 · 3 comments
Closed

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

shimingw opened this issue Dec 5, 2024 · 3 comments
Labels
🐞 bug Something isn't working

Comments

@shimingw
Copy link

shimingw commented Dec 5, 2024

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

@shimingw shimingw added the 🐞 bug Something isn't working label Dec 5, 2024
@fi3ework
Copy link
Member

fi3ework commented Dec 5, 2024

Can you describe the problem in detail? It would be helpful if you could provide a minimal reproduction.

I guess if you want import x from './suggestTable to be compiled as import x from './suggestTable/index.js, Rslib currently does not support automatic completion of main files. You need to provide the full /index path. For reference, see https://lib.rsbuild.dev/config/lib/auto-extension#default-extension. We will support this in near future.

@shimingw
Copy link
Author

shimingw commented Dec 5, 2024

Can you describe the problem in detail? It would be helpful if you could provide a minimal reproduction.

I guess if you want import x from './suggestTable to be compiled as import x from './suggestTable/index.js, Rslib currently does not support automatic completion of main files. You need to provide the full /index path. For reference, see https://lib.rsbuild.dev/config/lib/auto-extension#default-extension. We will support this in near future.

OK,i understand it,thank for your reply

@Timeless0911
Copy link
Collaborator

tracking in #238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants