mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* [webpack-serve] create a new subfolder with the v1 * [webpack-serve] update to version 2.0.0 * [webpack-serve] add the correct path mapping for the v1
50 lines
1.0 KiB
TypeScript
50 lines
1.0 KiB
TypeScript
import webpack = require('webpack');
|
|
import serve = require('webpack-serve');
|
|
|
|
const webpackConfig: webpack.Configuration = {
|
|
entry: { index: './index.js' },
|
|
};
|
|
|
|
const webpackCompiler = webpack(webpackConfig);
|
|
|
|
const serveConfig: serve.Options = {
|
|
add: (app, middleware, options) => {
|
|
middleware.content();
|
|
middleware.webpack();
|
|
},
|
|
compiler: webpackCompiler,
|
|
config: webpackConfig,
|
|
content: './webroot',
|
|
clipboard: true,
|
|
devMiddleware: {
|
|
logLevel: 'warn',
|
|
publicPath: '/',
|
|
},
|
|
host: 'localhost',
|
|
hotClient: {
|
|
logLevel: 'warn',
|
|
allEntries: true,
|
|
},
|
|
http2: true,
|
|
https: {},
|
|
logLevel: 'info',
|
|
logTime: false,
|
|
on: {
|
|
'build-finished': args => {
|
|
console.log(args.stats.toString());
|
|
},
|
|
},
|
|
open: {
|
|
path: '/index.html',
|
|
},
|
|
port: 65080,
|
|
};
|
|
|
|
const promise = serve({}, serveConfig);
|
|
|
|
promise.then(result => {
|
|
result.on('compiler-error', args => {
|
|
console.log(args.stats);
|
|
});
|
|
});
|