Skip to content

插件不生效 #37

Description

@0little

Versions

  • originjs: 1.0.3
  • node: 14.19.0
  • vite: 3.0.2

按照如下文件配置后,插件没有生效,commonjs代码没有被转成es代码,所以报错:The requested module '/_fusion/lib/index.js' does not provide an export named 'Affix'

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'
import * as path from 'path';

const projectRootDir = path.resolve(__dirname);

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: [
      { find: '@', replacement: path.resolve(projectRootDir, 'src') },
      {
        find: '@fusion',
        replacement: path.resolve(projectRootDir, '_fusion'),
      },
      {
        find: /^~(.*)$/,
        replacement: '$1',
      }  
    ]
  },
  plugins: [ viteCommonjs(), react()],
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions