Only create reference to vendor.dll.js in developement

Also changed filenames to fit with more modern webpack conventions
pull/2903/head
Andrew Watkins 2018-02-25 22:49:50 -07:00
parent 0df1ce1c08
commit 311b5e538d
5 changed files with 38 additions and 7 deletions

View File

@ -9,12 +9,12 @@
"url": "github:influxdata/chronograf"
},
"scripts": {
"build": "yarn run clean && webpack --config ./webpack/prodConfig.js",
"build:dev": "webpack --config ./webpack/devConfig.js",
"build": "yarn run clean && webpack --config ./webpack/prod.config.js",
"build:dev": "webpack --config ./webpack/dev.config.js",
"build:vendor": "webpack --config webpack/vendor.config.js",
"start": "yarn run clean && yarn run build:vendor && webpack --watch --config ./webpack/devConfig.js",
"start:assets": "webpack --watch --config ./webpack/devConfig.js",
"start:hmr": "webpack-dev-server --open --config ./webpack/devConfig.js",
"start": "yarn run clean && yarn run build:vendor && webpack --watch --config ./webpack/dev.config.js",
"start:assets": "webpack --watch --config ./webpack/dev.config.js",
"start:hmr": "webpack-dev-server --open --config ./webpack/dev.config.js",
"lint": "esw src/",
"test": "karma start --single-run",
"test:lint": "yarn run lint; yarn run test",
@ -35,6 +35,7 @@
"@types/mocha": "^2.2.48",
"@types/node": "^9.4.6",
"@types/react": "^16.0.38",
"add-asset-html-webpack-plugin": "^2.1.2",
"autoprefixer": "^6.3.1",
"babel-core": "^6.5.1",
"babel-eslint": "6.1.2",
@ -70,6 +71,7 @@
"fork-ts-checker-webpack-plugin": "^0.3.0",
"hanson": "^1.1.1",
"hson-loader": "^1.0.0",
"html-webpack-include-assets-plugin": "^1.0.2",
"html-webpack-plugin": "^2.30.1",
"imports-loader": "^0.6.5",
"jsdom": "^9.0.0",

View File

@ -8,7 +8,6 @@
<body>
<div id='react-root' data-basepath=""></div>
<script type="text/javascript" src="/vendor/vendor.dll.js"></script>
</body>
</body>

View File

@ -4,6 +4,7 @@ const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const WebpackOnBuildPlugin = require('on-build-webpack')
const HtmlWebpackIncludeAssetsPlugin = require('html-webpack-include-assets-plugin')
const keys = require('lodash/keys')
const difference = require('lodash/difference')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
@ -20,6 +21,11 @@ const babelLoader = {
},
}
const log = function(x) {
console.log('IM LOGGIN HERE: ', x)
return x
}
module.exports = {
node: {
fs: 'empty',
@ -152,6 +158,10 @@ module.exports = {
inject: 'body',
favicon: 'assets/images/favicon.ico',
}),
new HtmlWebpackIncludeAssetsPlugin({
assets: ['vendor.dll.js'],
append: false,
}),
new webpack.DefinePlugin({
VERSION: JSON.stringify(require('../package.json').version),
}),
@ -167,6 +177,10 @@ module.exports = {
const filesToRemove = difference(buildDirFiles, assetFileNames)
for (const file of filesToRemove) {
if (file.includes('dll')) {
return
}
const ext = path.extname(file)
if (['.js', '.json', '.map'].includes(ext)) {
fs.unlink(path.join(buildDir, file), unlinkErr => {

View File

@ -98,6 +98,14 @@ acorn@^5.0.0, acorn@^5.2.1, acorn@^5.3.0, acorn@^5.4.0, acorn@^5.4.1:
version "5.4.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102"
add-asset-html-webpack-plugin@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/add-asset-html-webpack-plugin/-/add-asset-html-webpack-plugin-2.1.2.tgz#b3e60192602cdc53f03f2b19b7de36b5c4a6c7fe"
dependencies:
bluebird "^3.5.0"
globby "^6.1.0"
minimatch "^3.0.4"
add-px-to-style@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/add-px-to-style/-/add-px-to-style-1.0.0.tgz#d0c135441fa8014a8137904531096f67f28f263a"
@ -1329,7 +1337,7 @@ block-stream@*:
dependencies:
inherits "~2.0.0"
bluebird@^3.1.1, bluebird@^3.3.0, bluebird@^3.4.6, bluebird@^3.4.7, bluebird@^3.5.1:
bluebird@^3.1.1, bluebird@^3.3.0, bluebird@^3.4.6, bluebird@^3.4.7, bluebird@^3.5.0, bluebird@^3.5.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9"
@ -4255,6 +4263,14 @@ html-minifier@^3.2.3:
relateurl "0.2.x"
uglify-js "3.3.x"
html-webpack-include-assets-plugin@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/html-webpack-include-assets-plugin/-/html-webpack-include-assets-plugin-1.0.2.tgz#8d36eadb81e9e6bf40b56dc2ae77c3d155295106"
dependencies:
glob "^7.1.2"
minimatch "^3.0.4"
slash "^1.0.0"
html-webpack-plugin@^2.30.1:
version "2.30.1"
resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-2.30.1.tgz#7f9c421b7ea91ec460f56527d78df484ee7537d5"