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

插件不生效 #37

Open
0little opened this issue Jul 27, 2022 · 0 comments
Open

插件不生效 #37

0little opened this issue Jul 27, 2022 · 0 comments

Comments

@0little
Copy link

0little commented Jul 27, 2022

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()],
})
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

1 participant