forked from parse-community/parse-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.config.js
88 lines (85 loc) · 2.02 KB
/
base.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
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
/*
* Copyright (c) 2016-present, Parse, LLC
* All rights reserved.
*
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/
//This file should be imported by another config file, like build.config.js
const path = require('path');
const SvgPrepPlugin = require('./plugins/svg-prep');
// pulls in package.json and gets version
const webpack = require('webpack');
const fs = require('fs');
const json = JSON.parse(fs.readFileSync('package.json', 'utf8'));
const version = json.version;
module.exports = {
context: path.join(__dirname, '../src'),
output: {
filename: '[name].bundle.js',
publicPath: 'bundles/',
assetModuleFilename: 'img/[hash][ext]',
},
resolve: {
modules: [__dirname, path.join(__dirname, '../src'), path.join(__dirname, '../node_modules')],
},
resolveLoader: {
modules: [path.join(__dirname, '../node_modules')],
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: 2,
},
},
{
loader: 'sass-loader',
options: {
sassOptions: {
includePaths: [path.resolve(__dirname, '../src')],
},
},
},
],
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.png$/,
type: 'asset/resource',
},
{
test: /\.jpg$/,
type: 'asset/resource',
},
{
test: /\.flow$/,
use: 'null-loader',
},
],
},
plugins: [
new SvgPrepPlugin({
source: path.join(__dirname, '../src', 'icons'),
}),
new webpack.DefinePlugin({
'process.env': {
version: JSON.stringify(version),
},
}),
],
};