Created
August 9, 2020 02:57
-
-
Save lamchau/8d095d339258d59b4fb8e76699088e91 to your computer and use it in GitHub Desktop.
example date-fns bundler
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
import differenceInBusinessDays from 'date-fns/differenceInBusinessDays'; | |
import parse from 'date-fns/parse'; | |
import toDate from 'date-fns/toDate'; | |
export default { | |
differenceInBusinessDays, | |
parse, | |
toDate | |
}; |
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
{ | |
"dependencies": { | |
"date-fns": "^2.15.0" | |
}, | |
"devDependencies": { | |
"rollup": "^2.23.1", | |
"rollup-plugin-commonjs": "^10.1.0", | |
"rollup-plugin-node-resolve": "^5.2.0", | |
"rollup-plugin-terser": "^6.1.0" | |
}, | |
"scripts": { | |
"build": "rollup -c" | |
} | |
} |
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
import resolve from 'rollup-plugin-node-resolve'; | |
import commonJS from 'rollup-plugin-commonjs'; | |
import { terser } from 'rollup-plugin-terser'; | |
export default { | |
input: 'date-fns.js', | |
output: { | |
file: 'bundle.js', | |
format: 'iife', | |
name: 'dateFns' | |
}, | |
plugins: [ | |
resolve(), | |
commonJS({ | |
include: 'node_modules/**' | |
}), | |
terser() | |
], | |
treeshake: true | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment