-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(experimental): add
optimizeDeps
option
- Loading branch information
Showing
11 changed files
with
479 additions
and
398 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
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 @@ | ||
hyperfine "dum example:rollup-node-resolve" "dum example:esbuild-optimize-deps" --warmup 2 |
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import Foo from './foo' | ||
import * as Vue from 'vue' | ||
import React from 'react' | ||
import * as Three from 'three' | ||
import * as _ from 'lodash' | ||
|
||
console.log(Foo) | ||
export { Foo, Vue, React, Three, _ } |
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 |
---|---|---|
@@ -1,14 +1,25 @@ | ||
import path from 'path' | ||
import nodeResolve from '@rollup/plugin-node-resolve' | ||
import cjs from '@rollup/plugin-commonjs' | ||
|
||
// @ts-check | ||
const esbuild = require('../dist/index') | ||
const optimize = !!process.env.OPTIMIZE | ||
|
||
export default { | ||
input: 'example/index.js', | ||
input: path.join(__dirname, 'index.js'), | ||
output: { | ||
file: 'example/dist/index.js', | ||
dir: path.join(__dirname, 'dist'), | ||
format: 'cjs', | ||
}, | ||
plugins: [ | ||
esbuild({ | ||
minify: !isDev, | ||
esbuild.default({ | ||
minify: process.env.NODE_ENV === 'production', | ||
optimizeDeps: { | ||
include: optimize ? ['vue', 'react', 'three', 'lodash'] : [], | ||
}, | ||
}), | ||
!optimize && cjs(), | ||
!optimize && nodeResolve(), | ||
], | ||
} |
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
Oops, something went wrong.