Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// We need this to override some webpack classes (did not have time to tinker with pull requests, etc.)
const path = require('path');
const webpack = require('webpack');
const _ = require('lodash');
const fs = require('fs-extra');
const browserSync = require('browser-sync').create();
const devMiddleware = require('webpack-dev-middleware');
const hotMiddleware = require('webpack-hot-middleware');
const WriteFilePlugin = require('write-file-webpack-plugin');
const Webiny = require('webiny-cli/lib/webiny');
const Build = require('./../Build/task');
// Override logger callbacks - we do not need the default output
const Logger = require('browser-sync/lib/logger');
Logger.callbacks['service:running'] = _.noop;
Logger.callbacks['file:watching'] = _.noop;
let devMiddlewareInstance = null;
class Develop extends Build {
constructor(config) {
super(config);
this.domain = _.get(Webiny.getConfig(), 'cli.domain', 'http://localhost') + ':' + _.get(Webiny.getConfig(), 'cli.port', 3000);
this.webpackCallback = config.webpackCallback || null;
this.progressCallback = config.progressCallback || null;
}
run() {
const msg = 'Please be patient, the initial webpack build may take a few moments...';
const line = new Array(msg.length + 3).join('-');
// We need this to override some webpack classes (did not have time to tinker with pull requests, etc.)
const path = require('path');
const webpack = require('webpack');
const _ = require('lodash');
const fs = require('fs-extra');
const browserSync = require('browser-sync').create();
const devMiddleware = require('webpack-dev-middleware');
const hotMiddleware = require('webpack-hot-middleware');
const WriteFilePlugin = require('write-file-webpack-plugin');
const Webiny = require('webiny-cli/lib/webiny');
const Build = require('./../Build/task');
// Override logger callbacks - we do not need the default output
const Logger = require('browser-sync/lib/logger');
Logger.callbacks['service:running'] = _.noop;
Logger.callbacks['file:watching'] = _.noop;
let devMiddlewareInstance = null;
class Develop extends Build {
constructor(config) {
super(config);
this.domain = _.get(Webiny.getConfig(), 'cli.domain', 'http://localhost') + ':' + _.get(Webiny.getConfig(), 'cli.port', 3000);
this.webpackCallback = config.webpackCallback || null;
this.progressCallback = config.progressCallback || null;
}
run() {
const msg = 'Please be patient, the initial webpack build may take a few moments...';
const line = new Array(msg.length + 3).join('-');
Webiny.log("\n" + line);