Skip to content

Commit

Permalink
allow node and browser globals, lint webpack configs
Browse files Browse the repository at this point in the history
  • Loading branch information
PiggySpeed committed May 13, 2018
1 parent df9679b commit 7e045ab
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
4 changes: 4 additions & 0 deletions daemon/web/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"env": {
"browser": true,
"node": true
},
"extends": "airbnb",
"rules": {
"prefer-template": 0,
Expand Down
2 changes: 0 additions & 2 deletions daemon/web/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global Request:true, fetch:true */

export default class InertiaClient {
constructor(url) {
this.url = 'https://' + url;
Expand Down
2 changes: 0 additions & 2 deletions daemon/web/components/Dashboard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* global TextDecoder:true */

import React from 'react';
import PropTypes from 'prop-types';

Expand Down
1 change: 0 additions & 1 deletion daemon/web/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global window:true, document:true */
import React from 'react';
import ReactDOM from 'react-dom';

Expand Down
15 changes: 7 additions & 8 deletions daemon/web/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

Expand Down Expand Up @@ -27,33 +26,33 @@ const config = {
options: {
presets: ['es2015', 'stage-3', 'react'],
},
}
},
],
},
{
test: /\.css/,
exclude: /node_modules/,
use: ['style-loader', 'css-loader'],
}
},
],
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
// define environment variables here
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
}
},
}),
new webpack.DefinePlugin({
// suppress react devtools console warning
'__REACT_DEVTOOLS_GLOBAL_HOOK__': '({ isDisabled: true })'
__REACT_DEVTOOLS_GLOBAL_HOOK__: '({ isDisabled: true })',
}),
new HtmlWebpackPlugin({
template: './index.html',
filename: 'index.html',
inject: 'body'
})
]
inject: 'body',
}),
],
};

module.exports = config;
8 changes: 4 additions & 4 deletions daemon/web/webpack.prod.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable */
const webpack = require('webpack');
const MinifyPlugin = require('babel-minify-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: './index.html',
filename: 'index.html',
Expand All @@ -26,21 +26,21 @@ const config = {
options: {
presets: ['es2015', 'react', 'stage-3'],
},
}
},
],
},
{
test: /\.css/,
exclude: /node_modules/,
use: ['style-loader', 'css-loader'],
}
},
],
},
plugins: [
new webpack.EnvironmentPlugin(['NODE_ENV']),
HtmlWebpackPluginConfig,
new MinifyPlugin(),
]
],
};

module.exports = config;

0 comments on commit 7e045ab

Please sign in to comment.