chore(*): cleanup webpack configs (#577)

This commit is contained in:
Nathan Bierema 2020-08-09 01:06:18 -04:00 committed by GitHub
parent 4ba5573803
commit 5ce9f42b2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 21 additions and 58 deletions

View File

@ -2,9 +2,9 @@
"name": "d3-state-visualizer-tree-example",
"version": "0.0.0",
"description": "Visualize your app state as a tree",
"main": "server.js",
"main": "index.js",
"scripts": {
"start": "node server.js"
"start": "webpack-dev-server --open"
},
"repository": {
"type": "git",

View File

@ -1,20 +0,0 @@
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,
stats: {
colors: true,
},
}).listen(3000, 'localhost', function (err) {
if (err) {
// eslint-disable-next-line no-console
console.log(err);
}
// eslint-disable-next-line no-console
console.log('Listening at localhost:3000');
});

View File

@ -28,4 +28,9 @@ module.exports = {
},
],
},
devServer: {
historyApiFallback: true,
hot: true,
port: 3000,
},
};

View File

@ -8,6 +8,7 @@ module.exports = {
},
output: {
library: 'd3-state-visualizer',
libraryExport: 'default',
libraryTarget: 'umd',
},
resolve: {

View File

@ -7,7 +7,7 @@
"clean": "rimraf lib dist",
"build": "babel src --out-dir lib",
"build:umd": "webpack --progress --config webpack.config.umd.js",
"build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js",
"build:umd:min": "webpack --env.production --progress --config webpack.config.umd.js",
"version": "npm run build",
"postversion": "git push && git push --tags && npm run clean",
"prepare": "npm run clean && npm run build",

View File

@ -1,7 +1,7 @@
const path = require('path');
module.exports = (env = {}) => ({
mode: 'production',
mode: env.production ? 'production' : 'development',
entry: {
app: ['./src/index.js'],
},
@ -9,7 +9,7 @@ module.exports = (env = {}) => ({
library: 'd3tooltip',
libraryTarget: 'umd',
path: path.resolve(__dirname, 'dist'),
filename: env.minimize ? 'd3tooltip.min.js' : 'd3tooltip.js',
filename: env.production ? 'd3tooltip.min.js' : 'd3tooltip.js',
},
module: {
rules: [
@ -20,10 +20,4 @@ module.exports = (env = {}) => ({
},
],
},
optimization: {
minimize: !!env.minimize,
},
performance: {
hints: false,
},
});

View File

@ -7,7 +7,7 @@
"clean": "rimraf lib dist",
"build": "babel src --out-dir lib",
"build:umd": "webpack --progress --config webpack.config.umd.js",
"build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js",
"build:umd:min": "webpack --env.production --progress --config webpack.config.umd.js",
"test": "jest",
"prepare": "npm run build && npm run build:umd",
"prepublishOnly": "npm run test && npm run clean && npm run build && npm run build:umd && npm run build:umd:min"

View File

@ -1,7 +1,7 @@
const path = require('path');
module.exports = (env = {}) => ({
mode: 'production',
mode: env.production ? 'production' : 'development',
entry: {
app: ['./src/index.js'],
},
@ -9,7 +9,7 @@ module.exports = (env = {}) => ({
library: 'd3tooltip',
libraryTarget: 'umd',
path: path.resolve(__dirname, 'dist'),
filename: env.minimize ? 'map2tree.min.js' : 'map2tree.js',
filename: env.production ? 'map2tree.min.js' : 'map2tree.js',
},
module: {
rules: [
@ -20,10 +20,4 @@ module.exports = (env = {}) => ({
},
],
},
optimization: {
minimize: !!env.minimize,
},
performance: {
hints: false,
},
});

View File

@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "React-Json-Tree example",
"scripts": {
"start": "node server.js",
"start": "webpack-dev-server --open",
"stats": "NODE_ENV=production webpack --json > dist/stats.json"
},
"repository": {

View File

@ -1,16 +0,0 @@
/* eslint-disable no-console */
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,
}).listen(3000, 'localhost', function (err) {
if (err) {
console.log(err);
}
console.log('Listening at localhost:3000');
});

View File

@ -26,4 +26,9 @@ module.exports = {
},
],
},
devServer: {
historyApiFallback: true,
hot: true,
port: 3000,
},
};

View File

@ -3,7 +3,7 @@ const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = (env = {}) => ({
mode: 'development',
mode: env.development ? 'development' : 'production',
entry: {
app: './index.js',
},