From fdfb02986e9c47882bf7d76f18446ebed397628c Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Tue, 29 Nov 2016 08:12:20 +0200 Subject: [PATCH] #242: build dlls during dev server start --- package.json | 4 ++-- scripts/build-dll.js | 21 +++++++++++++++++++++ scripts/i18n-collect.js | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 scripts/build-dll.js diff --git a/package.json b/package.json index a6e5959..bef3aaf 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,13 @@ "license": "UNLICENSED", "repository": "git@gitlab.ely.by:elyby/accounts.git", "scripts": { - "start": "rm -rf dist/ && webpack-dev-server --progress --colors", + "start": "rm -rf dist/ && npm run build:dll && webpack-dev-server --progress --colors", "up": "npm update", "test": "karma start ./karma.conf.js", "lint": "eslint ./src", "i18n": "babel-node ./scripts/i18n-collect.js", "build": "rm -rf dist/ && webpack --progress --colors -p", - "build:dll": "webpack --progress --colors --config webpack.dll.config.js" + "build:dll": "node ./scripts/build-dll.js" }, "dependencies": { "babel-polyfill": "^6.3.14", diff --git a/scripts/build-dll.js b/scripts/build-dll.js new file mode 100644 index 0000000..e8fd8fa --- /dev/null +++ b/scripts/build-dll.js @@ -0,0 +1,21 @@ +/* eslint-env node */ +/* eslint-disable no-console */ + +const webpack = require('webpack'); +const chalk = require('chalk'); + +const webpackConfig = require('../webpack.dll.config.js'); + +const compiler = webpack(webpackConfig); + +compiler.run(function(err, stats) { + if (err) { + console.error(chalk.red(err)); + process.exit(1); + } + + console.error( + chalk.green('Dll was successfully build in %s ms'), + stats.endTime - stats.startTime + ); +}); diff --git a/scripts/i18n-collect.js b/scripts/i18n-collect.js index ab8a0e6..884b9ec 100644 --- a/scripts/i18n-collect.js +++ b/scripts/i18n-collect.js @@ -1,3 +1,4 @@ +/* eslint-env node */ /* eslint-disable no-console */ import fs from 'fs'; import {sync as globSync} from 'glob';