@keqingrong/globals
v0.2.1
Published
Global identifiers for rollup's `output.globals` and webpack's `externals`
Downloads
6
Maintainers
Readme
@keqingrong/globals
Global identifiers for rollup's output.globals
and webpack's externals
Installation
# npm
npm install -D @keqingrong/globals
# yarn
yarn add -D @keqingrong/globals
Usage
rollup
// rollup.config.js
import globals from '@keqingrong/globals';
import pkg from './package.json';
export default {
// ...
external: Object.keys(pkg.dependencies),
output: {
globals,
},
};
webpack
// webpack.config.js
const globals = require('@keqingrong/globals');
const pkg = require('./package.json');
module.exports = {
// ...
externals: globals,
};
or
// webpack.config.js
const globals = require('@keqingrong/globals');
const pkg = require('./package.json');
const externals = {};
Object.keys(pkg.dependencies).forEach(name => {
if (globals[name]) {
externals[name] = {
commonjs: name,
amd: name,
root: globals[name],
};
}
});
module.exports = {
// ...
externals,
};
License
MIT © Qingrong Ke