move config into single file, add errors to help people migrate

This commit is contained in:
Rich Harris
2018-09-19 16:27:30 -04:00
parent 8f064fe5ac
commit 273823dfd7
16 changed files with 198 additions and 132 deletions

View File

@@ -1,4 +1,3 @@
import * as path from 'path';
import relative from 'require-relative';
import { CompileResult } from './interfaces';
import WebpackResult from './WebpackResult';
@@ -8,9 +7,9 @@ let webpack: any;
export class WebpackCompiler {
_: any;
constructor(config: string) {
constructor(config: any) {
if (!webpack) webpack = relative('webpack', process.cwd());
this._ = webpack(require(path.resolve(config)));
this._ = webpack(config);
}
oninvalid(cb: (filename: string) => void) {