Last active
July 14, 2020 06:40
Revisions
-
tcme revised this gist
Jan 17, 2016 . 4 changed files with 16 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ import * as Lib from 'lib'; console.log('APP'); console.log(Lib); console.log(Lib.capitalize('hello world')); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ <!doctype html> <title>test split lib and app</title> <meta charset="utf-8"> <main></main> <script src="build/lib.js"></script> <script src="build/app.js"></script> This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // used as entry point to build the common lib console.log('LIB ENTRY POINT'); import capitalize from 'string-capitalize'; export default { capitalize }; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,9 @@ }, "author": "Enrique Erne", "license": "MIT", "dependencies": { "string-capitalize": "^1.0.1" }, "devDependencies": { "babel-cli": "^6.3.17", "babel-eslint": "^4.1.6", -
tcme revised this gist
Jan 17, 2016 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,6 @@ intentionally not using .babelrc ``` npm i npm start ``` -
tcme revised this gist
Jan 17, 2016 . No changes.There are no files selected for viewing
-
tcme created this gist
Jan 17, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ import * as Lib from 'lib'; console.log('APP'); console.log(Lib); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ // used as entry point to build the common lib console.log('LIB ENTRY POINT'); import { a, b } from 'lib'; export default { a, b }; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ { "name": "test-split-app-lib", "version": "0.1.0", "description": "", "scripts": { "start": "npm run build-app & npm run build-lib", "build-app": "babel-node --presets es2015 rollup.app.js", "build-lib": "babel-node --presets es2015 rollup.lib.js" }, "author": "Enrique Erne", "license": "MIT", "dependencies": {}, "devDependencies": { "babel-cli": "^6.3.17", "babel-eslint": "^4.1.6", "babel-preset-es2015-rollup": "^1.1.1", "rollup": "^0.24.1", "rollup-plugin-babel": "^2.3.9", "rollup-plugin-commonjs": "^2.1.0", "rollup-plugin-npm": "^1.2.0" } } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ intentionally not using .babelrc This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ import { rollup } from 'rollup'; import npm from 'rollup-plugin-npm'; import commonjs from 'rollup-plugin-commonjs'; import babel from 'rollup-plugin-babel'; rollup({ 'entry': 'app.js', 'external': ['lib'], 'plugins': [ npm({ 'jsnext': true, 'main': true/*, skip: ['lib']*/}), commonjs(), babel({ 'babelrc': false, 'presets': ['es2015-rollup'] }) ] }) .then( bundle => bundle.write({ 'banner': '/* APP */', 'dest': 'build/app.js', 'format': 'iife', 'globals': { 'lib': 'Lib' }, 'sourceMap': true }) ) .catch( error => console.log(error) ); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ import { rollup } from 'rollup'; import npm from 'rollup-plugin-npm'; import commonjs from 'rollup-plugin-commonjs'; import babel from 'rollup-plugin-babel'; // import uglify from 'rollup-plugin-uglify'; rollup({ 'entry': 'lib.js', 'plugins': [ babel({ 'babelrc': false, 'presets': ['es2015-rollup'] }), npm({ 'jsnext': true, 'main': true}), commonjs() // uglify() ] }) .then( bundle => bundle.write({ 'dest': 'build/lib.js', // 'exports': 'named', 'format': 'iife', 'moduleName': 'Lib', 'banner': '/* Lib */', 'sourceMap': true }) ) .catch( error => console.log(error) );