-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathwebpack.dev.ts
More file actions
49 lines (41 loc) · 1.63 KB
/
Copy pathwebpack.dev.ts
File metadata and controls
49 lines (41 loc) · 1.63 KB
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
/***********************************************************
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License
**********************************************************/
import { Configuration as WebpackConfig, NormalModuleReplacementPlugin } from 'webpack';
import type { Configuration as WebpackDevServerConfig } from 'webpack-dev-server' with { 'resolution-mode': 'import' };
import { merge } from 'webpack-merge';
import common from './webpack.common';
interface Config extends WebpackConfig {
devServer?: WebpackDevServerConfig
}
const config: Config = merge(common, {
mode: 'development',
// Enable sourcemaps for debugging webpack's output.
devtool: 'source-map',
module: {
rules: [
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{ enforce: 'pre', test: /\.js$/, loader: 'source-map-loader', exclude: /node_modules/ },
{
test: /\.(scss|css)$/,
use: [
{ loader: 'style-loader'},
{ loader: 'css-loader', options: { sourceMap: true}},
{ loader: 'sass-loader', options: {sourceMap: true, implementation: require('sass')}}]
}
]
},
plugins: [
new NormalModuleReplacementPlugin(
/(.*)appConfig.ENV(\.*)/,
resource => resource.request = resource.request.replace(/ENV/, 'electrondev')
)
],
devServer: {
compress: true,
historyApiFallback: true,
allowedHosts: ['localhost', '127.0.0.1'],
}
});
export default config;