redoc/demo/webpack.config.ts
David Revay 5dc21af281 fix: A couple minor bug fixes (#436)
* Fix so deref always returns an object.
* Fix SelectOnClick so it does not crash
* chore: fix demo's webpack.config.ts
* Fix space
2018-03-14 08:05:57 +02:00

89 lines
1.9 KiB
TypeScript

import * as webpack from 'webpack';
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
const VERSION = JSON.stringify(require('../package.json').version);
const REVISION = JSON.stringify(
require('child_process')
.execSync('git rev-parse --short HEAD')
.toString()
.trim(),
);
export default {
entry: __dirname + '/index.tsx',
output: {
filename: 'redoc-demo.bundle.js',
path: __dirname + '/dist',
},
devServer: {
contentBase: __dirname,
watchContentBase: true,
port: 8081,
stats: 'errors-only',
},
devtool: 'eval',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
},
node: {
fs: 'empty',
},
module: {
rules: [
{ enforce: 'pre', test: /\.js$/, loader: 'source-map-loader' },
{ test: [/\.eot$/, /\.gif$/, /\.woff$/, /\.svg$/, /\.ttf$/], use: 'null-loader' },
{
test: /\.tsx?$/,
use: [
'react-hot-loader/webpack',
{
loader: 'awesome-typescript-loader',
options: {
module: 'es2015',
},
},
],
exclude: ['node_modules'],
},
{
test: /\.css$/,
use: {
loader: 'css-loader',
options: {
sourceMap: true,
minimize: true,
},
},
},
{
test: /node_modules\/(swagger2openapi|reftools)\/.*\.js$/,
use: {
loader: 'awesome-typescript-loader',
options: {
transpileOnly: true,
allowJs: true,
instance: 'ts2js-transpiler-only',
},
},
},
],
},
plugins: [
new webpack.DefinePlugin({
__REDOC_VERSION__: VERSION,
__REDOC_REVISION__: REVISION,
__REDOC_DEV__: false,
}),
new webpack.NamedModulesPlugin(),
new webpack.optimize.ModuleConcatenationPlugin(),
new HtmlWebpackPlugin({
template: 'demo/index.html',
}),
],
};