generated from tjx666/unplugin-starter
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
changfeng
committed
May 31, 2023
1 parent
bb7465b
commit a9eef36
Showing
9 changed files
with
76 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const rollupPluginCommonjs = require('@rollup/plugin-commonjs'); | ||
const rollupPluginJson = require('@rollup/plugin-json'); | ||
const rollupPLuginNodeResolve = require('@rollup/plugin-node-resolve'); | ||
const { defineConfig } = require('rollup'); | ||
|
||
const unpluginDetectDuplicatedDeps = require('../../../../dist/rollup.js'); | ||
|
||
module.exports = defineConfig({ | ||
input: 'index.js', | ||
output: { | ||
format: 'esm', | ||
file: './dist/bundle.mjs', | ||
}, | ||
plugins: [ | ||
rollupPluginCommonjs(), | ||
rollupPLuginNodeResolve(), | ||
rollupPluginJson(), | ||
unpluginDetectDuplicatedDeps(), | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[warn] multiple versions of axios is bundled! | ||
|
||
axios: | ||
- 0.27.2 imported by tests/fixtures/mono/packages/pkg2/index.js, axios@0.27.2 | ||
- 1.4.0 imported by axios@1.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[0m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import fs from 'node:fs/promises'; | ||
import { resolve } from 'node:path'; | ||
|
||
import { execa } from 'execa'; | ||
import { expect, test } from 'vitest'; | ||
|
||
const testCwd = resolve(__dirname, './fixtures/mono/app'); | ||
|
||
const stdout = await fs.readFile(resolve(testCwd, 'stdout.txt'), 'utf8'); | ||
const stderr = await fs.readFile(resolve(testCwd, 'stderr.txt'), 'utf8'); | ||
const exec = async (command: string) => { | ||
const [cmd, ...args] = command.split(' '); | ||
const result = await execa(cmd, args, { | ||
cwd: testCwd, | ||
preferLocal: true, | ||
}); | ||
return result; | ||
}; | ||
|
||
test('vite esm', async () => { | ||
const result = await exec('vite build -l error -c vite.config.mts'); | ||
expect(result.stdout).toBe(stdout); | ||
expect(result.stderr).toBe(stderr); | ||
}); | ||
|
||
test('vite cjs', async () => { | ||
const result = await exec('vite build -l error -c vite.config.cts'); | ||
expect(result.stdout).toBe(stdout); | ||
expect(result.stderr).toBe(stderr); | ||
}); | ||
|
||
test('rollup esm', async () => { | ||
const result = await exec('rollup --silent -c rollup.config.mjs'); | ||
expect(result.stdout).toBe(stdout); | ||
expect(result.stderr).toBe(stderr); | ||
}); | ||
|
||
test('rollup cjs', async () => { | ||
const result = await exec('rollup --silent -c rollup.config.cjs'); | ||
expect(result.stdout).toBe(stdout); | ||
expect(result.stderr).toBe(stderr); | ||
}); |