This commit is contained in:
Zadat Olayinka 2020-06-08 18:28:12 +01:00
parent 9cb2c3dfab
commit 2768116bb2
5 changed files with 352 additions and 1829 deletions

View File

@ -1,17 +0,0 @@
// gulpfile.js
var gulp = require( "gulp" );
var webpack = require( "webpack-stream" );
var sourcemaps = require( "gulp-sourcemaps" );
var rename = require( "gulp-rename" );
var uglify = require( "gulp-uglify" );
gulp.task( "build", function() {
return gulp.src( "src/logger.js" )
.pipe( webpack( require( "./webpack.config.js" ) ) )
.pipe( gulp.dest( "./lib" ) )
.pipe( sourcemaps.init( { loadMaps: true } ) )
.pipe( uglify() )
.pipe( rename( "logger.min.js" ) )
.pipe( sourcemaps.write( "./" ) )
.pipe( gulp.dest( "lib/" ) );
} );

2113
log-js/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,10 @@
"name": "log-js",
"version": "1.0.0",
"description": "",
"main": "index.js",
"main": "dist/logger.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --mode production"
},
"keywords": [],
"author": "",
@ -12,14 +13,8 @@
"devDependencies": {
"@babel/core": "^7.10.2",
"babel-loader": "^8.1.0",
"gulp-rename": "^2.0.0",
"gulp-sourcemaps": "^2.6.5",
"gulp-uglify": "^3.0.2",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-stream": "^5.2.1"
"webpack-cli": "^3.3.11"
},
"dependencies": {
"gulp": "^4.0.2"
}
"dependencies": {}
}

View File

@ -42,3 +42,4 @@ class Logger {
}
}
}
export default Logger;

View File

@ -1,14 +1,23 @@
const path = require('path');
module.exports = {
entry: "./src/logger.js",
devtool: "#inline-source-map",
// output tells webpack where to put the bundle it creates
output: {
library: "logger",
// We want webpack to build a UMD wrapper for our module
libraryTarget: "umd",
// the destination file name
filename: "lib/logger.js"
},
};
mode: 'production',
entry: './src/logger.js',
output: {
path: path.resolve('dist'),
filename: 'logger.js',
libraryTarget: 'commonjs2',
},
module: {
rules: [
{
test: /\.js?$/,
exclude: /(node_modules)/,
use: 'babel-loader',
},
],
},
resolve: {
extensions: ['.js'],
},
};