-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
49 lines (47 loc) · 1.71 KB
/
webpack.config.js
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
const path = require('path');
const MiniCssExtractPlugin= require('mini-css-extract-plugin');
module.exports = {
mode: 'development',
entry: {
main: './resources/js/main.tsx',
styles: './resources/css/styles.js'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'static/Main/js')
},
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: "[name].css",
chunkFilename: "[id].css"
})
],
module: {
rules: [{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.scss$/,
use: [
/**
* Style-loader: This is used to pack css as part of Main JS file
* MiniCssExtractPlugin: This plugin extracts CSS from main JS
* file as a seperate CSS file.
* Only Have any one of them active and comment the other
*/
"style-loader", // creates style nodes from JS strings
// MiniCssExtractPlugin.loader,
"css-loader", // translates CSS into CommonJS
"sass-loader", // compiles Sass to CSS, using Node Sass by default
"postcss-loader", // Perform PostCSS actions on SCSS
]
}]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
};