How to use steal-rollup - 2 common examples

To help you get started, we’ve selected a few steal-rollup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stealjs / steal-tools / lib / bundle / concat_source_es.js View on Github external
module.exports = function(bundle, options) {
	let removeDevelopmentCode = options.removeDevelopmentCode;
	let main = bundle.bundles[0];
	let firstNode = bundle.nodes[0];

	let nodeMap = new Map();
	for(let node of bundle.nodes) {
		nodeMap.set(node.load.name + ".js", node);
	}
	let getNode = nodeMap.get.bind(nodeMap);

	return rollup.rollup({
		input: main,

		plugins: [
			loadFromGraph(getNode, removeDevelopmentCode),
			pluginCommonjs({})
		]
	})
	.then(function(bundle){
		return bundle.generate({
			format:'es',
			sourcemap: true
		});
	})
	.then(function(chunk){
		let sourceCode = chunk.code;
		if(isProcessShim(firstNode)) {
github stealjs / steal-tools / lib / graph / treeshake.js View on Github external
function treeshake(data) {
	let getNode = id => data.graph[id];
	let mains = uniq(data.mains.concat(data.loader.bundle));
	let cwd = process.cwd().substr(1);
	if (os.type().toLowerCase() === "windows_nt"){
		cwd = process.cwd().substr(3);
	}

	return rollup.rollup({
		entry: mains,
		acorn: {
			allowReserved: true,
			ecmaVersion: 9
		},
		experimentalPreserveModules: true,
		experimentalCodeSplitting: true,
		plugins: [
			loadFromGraph(getNode, data),
			transpile(getNode, data)
		],
		onwarn: function(){}
	}).then(function(bundle){
		return bundle.generate({
			format:'es',
			resolveImports: resolveImports.bind(null, cwd)

steal-rollup

Next-generation ES6 module bundler

MIT
Latest version published 6 years ago

Package Health Score

69 / 100
Full package analysis

Popular steal-rollup functions