This repository has been archived by the owner on May 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: better packaging for distribution
- Loading branch information
1 parent
edd7f3e
commit 50558bf
Showing
6 changed files
with
167 additions
and
61 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
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,33 @@ | ||
const path = require('path'); | ||
const pack = require('./package.json'); | ||
const replace = require('rollup-plugin-replace'); | ||
// const flow = require('rollup-plugin-flow-no-whitespace'); | ||
const buble = require('rollup-plugin-buble'); | ||
const node = require('rollup-plugin-node-resolve'); | ||
const cjs = require('rollup-plugin-commonjs'); | ||
|
||
const resolve = _path => path.resolve(__dirname, _path); | ||
const name = 'VueI18next'; | ||
const fileName = 'vue-i18next'; | ||
const replacePluginOptions = { __VERSION__: `"${pack.version}"` }; | ||
|
||
const rollupPlugins = () => [ | ||
replace(replacePluginOptions), | ||
buble({ objectAssign: 'Object.assign' }), | ||
node(), | ||
cjs(), | ||
]; | ||
|
||
const conf = (format, formatName) => ({ | ||
input: 'src/i18n.js', | ||
plugins: rollupPlugins(), | ||
external: ['deepmerge'], | ||
output: { | ||
file: resolve(`dist/${fileName}${formatName ? `.${formatName}` : ''}.js`), | ||
format, | ||
env: 'production', | ||
name, | ||
}, | ||
}); | ||
|
||
export default [conf('cjs', 'common'), conf('es', 'esm'), { ...conf('umd'), external: [] }]; |
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
Oops, something went wrong.