Skip to content

[Bug]: alias configuration does not take effect #553

@Lisheri

Description

@Lisheri

Version

System: macos14.3.1
npmPackages: pnpm
Rslib 0.1.12

Details

rslib.config.ts

import { defineConfig } from '@rslib/core';
import { pluginVue } from '@rsbuild/plugin-vue';
import { pluginVueJsx } from '@rsbuild/plugin-vue-jsx';
import { pluginBabel } from '@rsbuild/plugin-babel';

export default defineConfig({
  resolve: {
    alias: {
      '@': './src'
    }
  },
  source: {
    entry: {
      index: ['./src/**']
    }
  },
  lib: [
    {
      bundle: false,
      dts: true,
      format: 'esm'
    }
  ],
  output: {
    target: 'web'
  },
  plugins: [
    pluginBabel({
      include: /\.(?:jsx|tsx)$/
    }),
    pluginVue(),
    pluginVueJsx()
  ],
  tools: {
    rspack: {
      plugins: [
        require('unplugin-vue-macros/rspack')({
          // 覆盖插件选项
          vue: pluginVue(),
          vueJsx: pluginVueJsx()
        })
      ]
    }
  }
});

tsconfig.json

{
  "compilerOptions": {
    "lib": ["DOM", "ES2021"],
    "module": "ESNext",
    "jsx": "preserve",
    "jsxFactory": "h",
    "jsxFragmentFactory": "Fragment",
    "strict": true,
    "skipLibCheck": true,
    "isolatedModules": true,
    "resolveJsonModule": true,
    "moduleResolution": "bundler",
    "useDefineForClassFields": true,
    "target": "esnext",
    "baseUrl": ".",
    "noImplicitAny": false,
    "types": ["unplugin-vue-macros/macros-global"],
    "paths": {
      "@/*": [
        "./src/*"
      ]
    },
  },
  "vueCompilerOptions": {
    "plugins": ["unplugin-vue-macros/volar"],
  },
  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
}

origincode
Image

after build
Image

after building, the path alias is not processed

Reproduce link

https://github.com/Lisheri/rslib_vue_components

Reproduce Steps

pnpm i
pnpm build
see dist/index.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions