This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #841 from LiskHQ/833-webpack-for-electron
Add Webpack configuration for the electron app - Closes #833
- Loading branch information
Showing
15 changed files
with
370 additions
and
177 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
File renamed without changes.
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
'color-primary': '#0288D1', | ||
'color-primary-dark': '#0288D1', | ||
'button-border-radius': '3px', | ||
'input-text-label-color': 'rgba(0,0,0,0.38)', | ||
}; |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const webpack = require('webpack'); | ||
const { resolve } = require('path'); | ||
const merge = require('webpack-merge'); | ||
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
const baseConfig = require('./webpack.config'); | ||
const reactConfig = require('./webpack.config.react'); | ||
const reactToolboxVariables = require('./reactToolbox.config'); | ||
/* eslint-enable import/no-extraneous-dependencies */ | ||
|
||
module.exports = merge(baseConfig, reactConfig, { | ||
output: { | ||
path: resolve(__dirname, '../app', '../dist'), | ||
filename: 'bundle.[name].js', | ||
}, | ||
devServer: { | ||
contentBase: 'src', | ||
inline: true, | ||
port: 8080, | ||
historyApiFallback: true, | ||
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
PRODUCTION: false, | ||
TEST: false, | ||
// because of https://fb.me/react-minification | ||
'process.env': { | ||
NODE_ENV: null, | ||
}, | ||
}), | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'vendor', | ||
}), | ||
], | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: ['css-hot-loader'].concat(ExtractTextPlugin.extract({ | ||
fallback: 'style-loader', | ||
use: [ | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
sourceMap: true, | ||
modules: true, | ||
importLoaders: 1, | ||
localIdentName: '[name]__[local]___[hash:base64:5]', | ||
}, | ||
}, | ||
{ | ||
loader: 'postcss-loader', | ||
options: { | ||
sourceMap: true, | ||
sourceComments: true, | ||
plugins: [ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
require('postcss-partial-import')({}), | ||
require('postcss-cssnext')({ | ||
features: { | ||
customProperties: { | ||
variables: reactToolboxVariables, | ||
}, | ||
}, | ||
}), | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
require('postcss-for')({}), | ||
], | ||
}, | ||
}, | ||
], | ||
})), | ||
}, | ||
], | ||
}, | ||
}); |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const { resolve } = require('path'); | ||
const merge = require('webpack-merge'); | ||
const baseConfig = require('./webpack.config'); | ||
/* eslint-enable import/no-extraneous-dependencies */ | ||
|
||
module.exports = merge(baseConfig, { | ||
entry: `${resolve(__dirname, '../app/src')}/main.js`, | ||
output: { | ||
path: resolve(__dirname, '../app/dist'), | ||
filename: 'main.js', | ||
}, | ||
target: 'electron-renderer', | ||
node: { | ||
__dirname: false, | ||
}, | ||
}); |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module.exports = { | ||
node: { | ||
fs: 'empty', | ||
child_process: 'empty', | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
enforce: 'pre', | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
loader: 'eslint-loader', | ||
options: {}, | ||
}, | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['es2015', 'react', 'stage-3'], | ||
plugins: ['syntax-trailing-function-commas'], | ||
env: { | ||
test: { | ||
plugins: ['istanbul'], | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
test: /\.(eot|svg|ttf|woff|woff2|png)$/, | ||
loader: 'url-loader', | ||
}, | ||
{ | ||
test: /\.json$/, | ||
loaders: ['json-loader'], | ||
}, | ||
], | ||
}, | ||
}; |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const webpack = require('webpack'); | ||
const { resolve } = require('path'); | ||
const merge = require('webpack-merge'); | ||
const { NamedModulesPlugin } = require('webpack'); | ||
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
const baseConfig = require('./webpack.config'); | ||
const reactConfig = require('./webpack.config.react'); | ||
const reactToolboxVariables = require('./reactToolbox.config'); | ||
/* eslint-enable import/no-extraneous-dependencies */ | ||
|
||
module.exports = merge(baseConfig, reactConfig, { | ||
output: { | ||
path: resolve(__dirname, '../app', '../app/dist'), | ||
filename: 'bundle.[name].js', | ||
}, | ||
plugins: [ | ||
new webpack.DefinePlugin({ | ||
PRODUCTION: true, | ||
TEST: false, | ||
// because of https://fb.me/react-minification | ||
'process.env': { | ||
NODE_ENV: JSON.stringify('production'), | ||
}, | ||
}), | ||
new webpack.optimize.UglifyJsPlugin({ | ||
sourceMap: false, | ||
mangle: false, | ||
}), | ||
new NamedModulesPlugin(), | ||
new webpack.optimize.CommonsChunkPlugin({ | ||
name: 'vendor', | ||
}), | ||
], | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: ['css-hot-loader'].concat(ExtractTextPlugin.extract({ | ||
fallback: 'style-loader', | ||
use: [ | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
sourceMap: false, | ||
modules: true, | ||
importLoaders: 1, | ||
localIdentName: '[name]__[local]___[hash:base64:5]', | ||
}, | ||
}, | ||
{ | ||
loader: 'postcss-loader', | ||
options: { | ||
sourceMap: false, | ||
sourceComments: false, | ||
plugins: [ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
require('postcss-partial-import')({}), | ||
require('postcss-cssnext')({ | ||
features: { | ||
customProperties: { | ||
variables: reactToolboxVariables, | ||
}, | ||
}, | ||
}), | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
require('postcss-for')({}), | ||
], | ||
}, | ||
}, | ||
], | ||
})), | ||
}, | ||
], | ||
}, | ||
}); |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
const { resolve } = require('path'); | ||
const webpack = require('webpack'); | ||
const StyleLintPlugin = require('stylelint-webpack-plugin'); | ||
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
/* eslint-enable import/no-extraneous-dependencies */ | ||
|
||
const entries = { | ||
app: `${resolve(__dirname, '../src')}/main.js`, | ||
vendor: ['react', 'redux', 'react-dom'], | ||
}; | ||
|
||
module.exports = { | ||
entry: entries, | ||
devtool: 'source-map', | ||
devServer: { | ||
contentBase: 'src', | ||
inline: true, | ||
port: 8080, | ||
historyApiFallback: true, | ||
}, | ||
plugins: [ | ||
new StyleLintPlugin({ | ||
context: `${resolve(__dirname, '../src')}/`, | ||
files: '**/*.css', | ||
config: { | ||
extends: 'stylelint-config-standard', | ||
rules: { | ||
'selector-pseudo-class-no-unknown': null, | ||
'unit-whitelist': ['px', 'deg', '%', 'em', 'ms'], | ||
'length-zero-no-unit': null, | ||
}, | ||
ignoreFiles: './node_modules/**/*.css', | ||
}, | ||
}), | ||
new ExtractTextPlugin({ | ||
filename: 'styles.css', | ||
allChunks: true, | ||
}), | ||
], | ||
}; |
Oops, something went wrong.