Skip to content

Commit

Permalink
fix:config.ignore
Browse files Browse the repository at this point in the history
fix:取消代码压缩   pack:renderer -p
  • Loading branch information
willnewii committed Jul 8, 2017
1 parent e3a1032 commit d84a6cf
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 37 deletions.
3 changes: 2 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"axios": "^0.16.1",
"iview": "^2.0.0-rc.18",
"moment": "^2.18.1",
"qiniu": "^6.1.13",
"qiniu": "^7.0.4",
"qs": "^6.4.0",
"vue": "^2.2.6",
"vue-electron": "^1.0.6",
"vue-router": "^2.1.2",
Expand Down
17 changes: 9 additions & 8 deletions app/src/main/index.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ process.env.NODE_ENV = 'development'
process.env.BABEL_ENV = 'main'

require('babel-register')({
ignore: /node_modules/
ignore: /node_modules/
})

// Install `electron-debug` with `devtron`
require('electron-debug')({ showDevTools: true })
require('electron-debug')({showDevTools: true})

// Install `vue-devtools`
require('electron').app.on('ready', () => {
let installExtension = require('electron-devtools-installer')
installExtension.default(installExtension.VUEJS_DEVTOOLS)
.then(() => {})
.catch(err => {
console.log('Unable to install `vue-devtools`: \n', err)
})
let installExtension = require('electron-devtools-installer')
installExtension.default(installExtension.VUEJS_DEVTOOLS)
.then(() => {
})
.catch(err => {
console.log('Unable to install `vue-devtools`: \n', err)
})
})

// Require `main` process to boot app
Expand Down
14 changes: 7 additions & 7 deletions app/src/renderer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import store from './vuex/store'
import iView from 'iview';
import 'iview/dist/styles/iview.css';

Vue.use(Electron)
Vue.use(Router)
Vue.use(iView)
Vue.config.debug = false
Vue.use(Electron);
Vue.use(Router);
Vue.use(iView);
Vue.config.debug = false;


const router = new Router({
scrollBehavior: () => ({y: 0}),
routes
})
});

//拦截器
import axios from 'axios'
import axios from 'axios';
axios.interceptors.response.use((response) => {
return response;
}, (error) => {
Expand All @@ -35,4 +35,4 @@ new Vue({
router,
store,
...App
}).$mount('#app')
}).$mount('#app');
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let config = {
asar: false,
dir: path.join(__dirname, 'app'),
icon: path.join(__dirname, 'app/icons/icon'),
ignore: /\b(src|index\.ejs|icons)\b/,
ignore: /(^\/(src|test|\.[a-z]+|README|yarn|static|dist\/web))|\.gitkeep/,
out: path.join(__dirname, 'builds'),
overwrite: true,
platform: process.env.PLATFORM_TARGET || 'all'
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qiniu-Client",
"version": "0.0.2",
"version": "0.0.3",
"description": "An electron-vue project",
"scripts": {
"build:clean": "cross-env PLATFORM_TARGET=clean node tasks/release.js",
Expand All @@ -10,7 +10,7 @@
"dev": "node tasks/runner.js",
"pack": "npm run pack:main && npm run pack:renderer",
"pack:main": "cross-env NODE_ENV=production webpack -p --progress --colors --config webpack.main.config.js",
"pack:renderer": "cross-env NODE_ENV=production webpack -p --progress --colors --config webpack.renderer.config.js",
"pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config webpack.renderer.config.js",
"postinstall": "cd app && npm install",
"build": "node tasks/release.js"
},
Expand All @@ -19,7 +19,7 @@
"build:mas": "cross-env PLATFORM_TARGET=mas node tasks/release.js",
"build:win32": "cross-env PLATFORM_TARGET=win32 node tasks/release.js"
},
"author": "Greg Holguin <simulatedgreg@gmail.com>",
"author": "诗人的咸鱼 <willnewii@163.com>",
"license": "MIT",
"devDependencies": {
"babel-core": "^6.8.0",
Expand All @@ -29,6 +29,7 @@
"babel-preset-stage-0": "^6.5.0",
"babel-register": "^6.18.0",
"babel-runtime": "^6.6.1",
"babili-webpack-plugin": "^0.1.2",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^3.1.4",
"css-loader": "^0.26.1",
Expand All @@ -44,7 +45,7 @@
"html-webpack-plugin": "^2.16.1",
"json-loader": "^0.5.4",
"node-sass": "^4.5.2",
"qs": "^6.4.0",
"prepack-webpack-plugin": "^1.0.1",
"sass-loader": "^6.0.3",
"style-loader": "^0.13.1",
"tree-kill": "^1.1.0",
Expand All @@ -59,7 +60,6 @@
},
"dependencies": {
"electron-json-storage": "^3.0.4",
"node-notifier": "^5.1.2",
"prepack-webpack-plugin": "^1.0.1"
"node-notifier": "^5.1.2"
}
}
3 changes: 1 addition & 2 deletions webpack.main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
let mainConfig = {
entry: {
main: path.join(__dirname, 'app/src/main/index.js')

},
externals: Object.keys(pkg.dependencies || {}),
//externals: Object.keys(pkg.dependencies || {}),
module: {
rules: [
{
Expand Down
25 changes: 13 additions & 12 deletions webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const pkg = require('./app/package.json')
const settings = require('./config.js')
const webpack = require('webpack')

const BabiliWebpackPlugin = require('babili-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')

Expand Down Expand Up @@ -49,6 +50,7 @@ let rendererConfig = {
use: {
loader: 'vue-loader',
options: {
extractCSS: process.env.NODE_ENV === 'production',
loaders: {
sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1',
scss: 'vue-style-loader!css-loader!sass-loader'
Expand Down Expand Up @@ -95,10 +97,6 @@ let rendererConfig = {
},
externals: Object.keys(pkg.dependencies || {}).filter(d => !['vue', 'iview'].includes(d)),
resolve: {
modules: [
path.join(__dirname, 'app/node_modules'),
path.join(__dirname, 'node_modules')
],
alias: {
'vue$': path.join(__dirname, 'app/node_modules/vue/dist/vue.esm.js'),
'components': path.join(__dirname, 'app/src/renderer/components'),
Expand All @@ -113,21 +111,24 @@ let rendererConfig = {
* Adjust rendererConfig for production settings
*/
if (process.env.NODE_ENV === 'production') {
// rendererConfig.devtool = ''
rendererConfig.devtool = ''

rendererConfig.plugins.push(
new BabiliWebpackPlugin({
removeConsole: true,
removeDebugger: true
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
/*,
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})*/
})/*,
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})*/
)
}

Expand Down

0 comments on commit d84a6cf

Please sign in to comment.