Skip to content

Commit

Permalink
fix: build Error: Cannot find module 'vue'
Browse files Browse the repository at this point in the history
  • Loading branch information
vaebe committed Jul 25, 2022
1 parent 5b44b23 commit 13f7708
Show file tree
Hide file tree
Showing 7 changed files with 3,500 additions and 6,691 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.DS_Store
node_modules
build
dist
dist-ssr
**/lib
Expand Down Expand Up @@ -31,6 +30,7 @@ packages/ccui/ui/theme/darkTheme.css
packages/ccui/docs/.vitepress/config/sidebar.ts
packages/ccui/docs/.vitepress/config/enSidebar.ts
packages/ccui/docs/.vitepress/config.ts.js
packages/ccui/build
**CHANGELOG.md
# test
packages/ccui/coverage
Expand Down
1 change: 1 addition & 0 deletions .ls-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ignore:
# ccui
- packages/ccui/node_modules
- packages/ccui/docs
- packages/ccui/build
- packages/ccui/ui/theme
- packages/cli/node_modules
- packages/build
4 changes: 2 additions & 2 deletions packages/cli/commands/build-nuxt-auto-import.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const path = require('path');
const fsExtra = require('fs-extra');

const outputDir = path.resolve(__dirname, '../../build');
const outputNuxtDir = path.resolve(__dirname, '../../build/nuxt');
const outputDir = path.resolve(__dirname, '../../ccui/build');
const outputNuxtDir = path.resolve(__dirname, '../../ccui/build/nuxt');

exports.createNuxtPlugin = () => {
const fileStr = `import { join } from 'pathe'
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ const nuxtBuild = require('./build-nuxt-auto-import');
const { isReadyToRelease } = require('../shared/utils');

const entryDir = path.resolve(__dirname, '../../ccui/ui');
const outputDir = path.resolve(__dirname, '../../build');
const outputDir = path.resolve(__dirname, '../../ccui/build');

const baseConfig = defineConfig({
configFile: false,
publicDir: false,
plugins: [vue(), vueJsx()]
});

// 排除vue会抛 Error: Cannot find module 'vue'
const rollupOptions = {
// external: ['vue', 'vue-router', '@vueuse/core', '@floating-ui/dom'],
external: ['vue-router', '@vueuse/core', '@floating-ui/dom'],
external: ['vue', 'vue-router', '@vueuse/core', '@floating-ui/dom'],
output: {
globals: {
vue: 'Vue'
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/generate-dts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fse = require('fs-extra');
const logger = require('../shared/logger');

const entryDir = path.resolve(__dirname, '../../ccui');
const outputDir = path.resolve(__dirname, '../../build');
const outputDir = path.resolve(__dirname, '../../ccui/build');

function generateIndexDts(buildDir) {
const fileStr = `import { App } from 'vue';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const fsExtra = require('fs-extra');
const { omit } = require('lodash');
const shell = require('shelljs');

const outputDir = path.resolve(__dirname, '../../build');
const outputDir = path.resolve(__dirname, '../../ccui/build');

const packageJson = require('../../ccui/package.json');

Expand Down
Loading

0 comments on commit 13f7708

Please sign in to comment.