This repository was archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathwebpack.config.js
More file actions
108 lines (107 loc) · 2.78 KB
/
Copy pathwebpack.config.js
File metadata and controls
108 lines (107 loc) · 2.78 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const WebpackBar = require('webpackbar')
const nodeExternals = require('webpack-node-externals')
module.exports = {
mode: 'development',
target: 'web',
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.tsx', '.jsx', '.js'],
alias: {
'@Common': path.resolve(__dirname, 'src/common'),
'@Domain': path.resolve(__dirname, 'src/domain')
}
},
plugins: [
new WebpackBar({
reporters: ['fancy'], // Webpackbar disables itself in docker by default
}),
new ExtractTextPlugin('[name].css'),
new CopyWebpackPlugin([{
from: path.resolve(__dirname, 'src/common/sass'),
to: path.resolve(__dirname, 'dist/sass')
}])
],
externals: [
nodeExternals()
],
entry: {
index: './src/index.ts',
'ui-components': './src/common/sass/app.scss'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
libraryTarget: 'commonjs'
},
module: {
rules: [
{
test: /.(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
use: {
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/' // where the fonts will go
}
}
},
{
test: /\.(tsx?)$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader'
}
},
{
test: /\.css$/,
include: [
path.resolve(__dirname, "src"),
path.resolve(__dirname, "node_modules/react-dates/lib/css")
],
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'postcss-loader',
options: {
sourceMap: true,
plugins: () => [
require('postcss-cssnext')()
]
}
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
// Related to: https://github.com/webpack-contrib/sass-loader/issues/351
outputStyle: 'compact',
includePaths: [
path.resolve(__dirname, 'node_modules/foundation-sites/scss'),
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, 'node_modules/compass-mixins/lib')
]
}
}
]
})
}
]
}
}