mirror of
https://gitlab.silvrtree.co.uk/martind2000/frontexpress.git
synced 2025-01-25 18:06:17 +00:00
replaced webpack by rollup to reduce browser bundle size (-3kb)
This commit is contained in:
parent
12621d0883
commit
a170883d93
@ -8,7 +8,7 @@
|
||||
[![Code Climate](https://codeclimate.com/github/camelaissani/frontexpress/badges/gpa.svg)](https://codeclimate.com/github/camelaissani/frontexpress)
|
||||
[![Coverage Status](https://coveralls.io/repos/github/camelaissani/frontexpress/badge.svg?branch=master)](https://coveralls.io/github/camelaissani/frontexpress?branch=master)
|
||||
![Coverage Status](https://david-dm.org/camelaissani/frontexpress.svg)
|
||||
![Size Shield](https://img.shields.io/badge/size-14.4kb-brightgreen.svg)
|
||||
![Size Shield](https://img.shields.io/badge/size-11.4kb-brightgreen.svg)
|
||||
|
||||
Code the front-end logic with the same style than on the back-end with express
|
||||
|
||||
|
@ -21,7 +21,8 @@
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"index.js",
|
||||
"webpack.config.babel.js",
|
||||
"rollup.config.dev.js",
|
||||
"rollup.config.prod.js",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
|
3019
frontexpress.js
3019
frontexpress.js
File diff suppressed because it is too large
Load Diff
4
frontexpress.min.js
vendored
4
frontexpress.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -12,7 +12,7 @@ import Middleware from './middleware';
|
||||
* @private
|
||||
*/
|
||||
|
||||
class Route {
|
||||
export class Route {
|
||||
|
||||
|
||||
/**
|
||||
|
12
package.json
12
package.json
@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "frontexpress",
|
||||
"version": "0.1.9",
|
||||
"version": "0.1.10",
|
||||
"description": "Frontexpress manages routes in browser like ExpressJS on Node",
|
||||
"main": "dist/frontexpress.js",
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"only-test": "mocha --compilers js:babel-core/register",
|
||||
"test": "npm run lint && babel-node node_modules/.bin/babel-istanbul cover node_modules/.bin/_mocha",
|
||||
"frontpackage": "webpack",
|
||||
"frontpackage": "rollup -c rollup.config.dev.js && rollup -c rollup.config.prod.js",
|
||||
"prepublish": "rimraf dist && babel lib -d dist"
|
||||
},
|
||||
"author": "Camel Aissani <camel.aissani@gmail.com> (https://nuageprive.fr)",
|
||||
@ -32,9 +32,8 @@
|
||||
"babel-core": "^6.10.4",
|
||||
"babel-eslint": "^6.1.2",
|
||||
"babel-istanbul": "^0.11.0",
|
||||
"babel-loader": "^6.2.4",
|
||||
"babel-plugin-add-module-exports": "^0.2.1",
|
||||
"babel-preset-es2015": "^6.9.0",
|
||||
"babel-preset-es2015-rollup": "^1.2.0",
|
||||
"babel-register": "^6.14.0",
|
||||
"chai": "^3.5.0",
|
||||
"eslint": "^3.1.0",
|
||||
@ -43,7 +42,10 @@
|
||||
"istanbul": "^0.4.4",
|
||||
"mocha": "^2.5.3",
|
||||
"rimraf": "^2.5.3",
|
||||
"rollup": "^0.35.10",
|
||||
"rollup-plugin-babel": "^2.6.1",
|
||||
"rollup-plugin-uglify": "^1.0.1",
|
||||
"sinon": "^1.17.4",
|
||||
"webpack": "^1.13.1"
|
||||
"uglify-js": "^2.7.3"
|
||||
}
|
||||
}
|
||||
|
13
rollup.config.dev.js
Normal file
13
rollup.config.dev.js
Normal file
@ -0,0 +1,13 @@
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import uglify from 'rollup-plugin-uglify';
|
||||
|
||||
export default {
|
||||
entry: 'lib/frontexpress.js',
|
||||
format: 'umd',
|
||||
moduleName:'frontexpress',
|
||||
plugins: [babel({
|
||||
babelrc: false,
|
||||
presets: ['es2015-rollup']
|
||||
})],
|
||||
dest: 'frontexpress.js'
|
||||
};
|
14
rollup.config.prod.js
Normal file
14
rollup.config.prod.js
Normal file
@ -0,0 +1,14 @@
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import uglify from 'rollup-plugin-uglify';
|
||||
|
||||
export default {
|
||||
entry: 'lib/frontexpress.js',
|
||||
format: 'umd',
|
||||
sourceMap: true,
|
||||
moduleName:'frontexpress',
|
||||
plugins: [babel({
|
||||
babelrc: false,
|
||||
presets: ['es2015-rollup']
|
||||
}), uglify()],
|
||||
dest: 'frontexpress.min.js'
|
||||
};
|
@ -1,29 +0,0 @@
|
||||
import webpack from 'webpack';
|
||||
import path from 'path';
|
||||
|
||||
const script = (name, min=false) => {
|
||||
return {
|
||||
entry: path.join(__dirname, 'index.js'),
|
||||
output: {
|
||||
path: __dirname,
|
||||
filename: min?`${name}.min.js`:`${name}.js`
|
||||
},
|
||||
devtool: min?'source-map':null,
|
||||
module: {
|
||||
loaders: [{
|
||||
test: /\.js/,
|
||||
loader: 'babel-loader'
|
||||
}]
|
||||
},
|
||||
plugins: !min?[]:[
|
||||
new webpack.optimize.DedupePlugin(),
|
||||
new webpack.optimize.OccurenceOrderPlugin(),
|
||||
new webpack.optimize.UglifyJsPlugin(),
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
export default [
|
||||
script('frontexpress'),
|
||||
script('frontexpress', true)
|
||||
];
|
Loading…
Reference in New Issue
Block a user