forked from Azure/azure-iot-explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.ts
55 lines (47 loc) · 1.93 KB
/
webpack.dev.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/***********************************************************
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License
**********************************************************/
import * as webpack from 'webpack';
import * as merge from 'webpack-merge';
import common from './webpack.common';
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // tslint:disable-line: no-var-requires
const config: webpack.Configuration = merge(common, {
mode: 'development',
// Enable sourcemaps for debugging webpack's output.
devtool: 'source-map',
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{ test: /\.tsx?$/, loader: 'awesome-typescript-loader' },
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{ enforce: 'pre', test: /\.js$/, loader: 'source-map-loader' },
{
test: /\.(scss|css)$/,
use: [
{ loader: 'style-loader'},
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { sourceMap: true}},
{ loader: 'sass-loader', options: {sourceMap: true}}]
}
]
},
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// all options are optional
chunkFilename: '[id].css',
filename: '[name].css',
ignoreOrder: false, // Enable to remove warnings about conflicting order
}),
new webpack.NormalModuleReplacementPlugin(
/(.*)appConfig.ENV(\.*)/,
resource => resource.request = resource.request.replace(/ENV/, 'dev')
)
],
devServer: {
compress: true,
historyApiFallback: true,
}
});
export default config;