Dev: Update webpack config
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
anim
|
anim
|
||||||
|
devtool
|
||||||
|
draggabilly
|
||||||
eruda
|
eruda
|
||||||
|
iframe
|
||||||
scss
|
scss
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "eruda",
|
"name": "eruda",
|
||||||
"version": "0.6.5",
|
"version": "0.7.0",
|
||||||
"description": "Console for Mobile Browsers",
|
"description": "Console for Mobile Browsers",
|
||||||
"main": "dist/eruda.js",
|
"main": "dist/eruda.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack --watch",
|
"release": "webpack && webpack -p --config script/release.js",
|
||||||
"release": "webpack & webpack -p --output-filename eruda.min.js & uglifyjs dist/eruda.min.js -o dist/eruda.min.js --mangle --comments all",
|
"dev": "webpack-dev-server"
|
||||||
"serve": "nws -p 3000"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
17
script/release.js
Normal file
17
script/release.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
var webpack = require('webpack');
|
||||||
|
|
||||||
|
exports = require('./../webpack.config');
|
||||||
|
|
||||||
|
exports.output.filename = 'eruda.min.js';
|
||||||
|
exports.devtool = false;
|
||||||
|
exports.plugins = exports.plugins.concat([
|
||||||
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
|
compress: {
|
||||||
|
warnings: false
|
||||||
|
},
|
||||||
|
comments: /eruda/
|
||||||
|
}),
|
||||||
|
new webpack.optimize.DedupePlugin()
|
||||||
|
]);
|
||||||
|
|
||||||
|
module.exports = exports;
|
||||||
@@ -28,13 +28,16 @@ export default class EntryBtn extends util.Emitter
|
|||||||
{
|
{
|
||||||
var cfg = this.config,
|
var cfg = this.config,
|
||||||
pos = cfg.get('pos'),
|
pos = cfg.get('pos'),
|
||||||
defPost = getDefPos();
|
defPos = getDefPos();
|
||||||
|
|
||||||
var outOfRange = pos.x > defPost.x + 10 || pos.y > defPost.y + 10;
|
var outOfRange = pos.x > defPos.x + 10 ||
|
||||||
|
pos.x < 0 ||
|
||||||
|
pos.y < 0 ||
|
||||||
|
pos.y > defPos.y + 10;
|
||||||
|
|
||||||
if (outOfRange ||
|
if (outOfRange ||
|
||||||
!cfg.get('rememberPos') ||
|
!cfg.get('rememberPos') ||
|
||||||
orientationChanged) pos = defPost;
|
orientationChanged) pos = defPos;
|
||||||
|
|
||||||
this._$el.css({
|
this._$el.css({
|
||||||
left: pos.x,
|
left: pos.x,
|
||||||
|
|||||||
@@ -5,13 +5,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<title>Eruda</title>
|
<title>Eruda</title>
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
|
<script src="assets/eruda.js"></script>
|
||||||
<script>
|
|
||||||
window.onerror = function (msg) {
|
|
||||||
alert(msg);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script src="../dist/eruda.js"></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="test-element" class="border" style="color:red">
|
<div id="test-element" class="border" style="color:red">
|
||||||
@@ -58,28 +52,28 @@
|
|||||||
}
|
}
|
||||||
setTimeout(function ()
|
setTimeout(function ()
|
||||||
{
|
{
|
||||||
req('http://localhost:3000/test/style.css');
|
req('http://localhost:8080/webpack-dev-server/test/style.css');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
setTimeout(function ()
|
setTimeout(function ()
|
||||||
{
|
{
|
||||||
req('http://localhost:3000/test/data.json');
|
req('http://localhost:8080/webpack-dev-server/test/data.json');
|
||||||
}, 2000);
|
}, 2000);
|
||||||
setTimeout(function ()
|
setTimeout(function ()
|
||||||
{
|
{
|
||||||
req('http://localhost:3000/test/empty.json');
|
req('http://localhost:8080/webpack-dev-server/test/empty.json');
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.responseType = 'arraybuffer';
|
xhr.responseType = 'arraybuffer';
|
||||||
xhr.open('GET', 'http://localhost:3000/test/data.json');
|
xhr.open('GET', 'http://localhost:8080/webpack-dev-server/test/data.json');
|
||||||
xhr.send();
|
xhr.send();
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
var el = document.createElement('div');
|
var el = document.createElement('div');
|
||||||
document.body.appendChild(el);
|
document.body.appendChild(el);
|
||||||
eruda.init({container: el});
|
setTimeout(function () { eruda.init({container: el}) }, 1000);
|
||||||
</script>
|
</script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script>
|
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script>
|
||||||
<script>FastClick.attach(document.body);</script>
|
<script>FastClick.attach(document.body);</script>-->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -8,9 +8,16 @@ var nodeModDir = path.resolve('./node_modules/') + '/',
|
|||||||
banner = pkg.name + ' v' + pkg.version + ' ' + pkg.homepage;
|
banner = pkg.name + ' v' + pkg.version + ' ' + pkg.homepage;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
devtool: 'source-map',
|
||||||
entry: './src/index.es6',
|
entry: './src/index.es6',
|
||||||
|
devServer: {
|
||||||
|
contentBase: './test'
|
||||||
|
},
|
||||||
output: {
|
output: {
|
||||||
path: __dirname + '/dist/',
|
path: __dirname + '/dist/',
|
||||||
|
devtoolLineToLine: true,
|
||||||
|
sourceMapFilename: "./eruda.js.map",
|
||||||
|
publicPath: "/assets/",
|
||||||
filename: 'eruda.js',
|
filename: 'eruda.js',
|
||||||
library: ['eruda'],
|
library: ['eruda'],
|
||||||
libraryTarget: 'umd'
|
libraryTarget: 'umd'
|
||||||
|
|||||||
Reference in New Issue
Block a user