forked from anvilinsights/data-studio-react-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
48 lines (45 loc) · 1.18 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
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const CSS_FILE = process.env.npm_package_dsccViz_cssFile
const MANIFEST = 'manifest.json'
const INDEX_JSON = 'index.json'
const IS_DEV = process.env.NODE_ENV !== 'production'
module.exports = [
{
mode: IS_DEV ? 'development' : 'production',
entry: './src/index.js',
devServer: {
contentBase: './dist',
},
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'build'),
},
plugins: [
new CopyWebpackPlugin([
{ from: path.join('src', CSS_FILE), to: '.' },
{ from: path.join('src', MANIFEST), to: '.' },
{ from: path.join('src', INDEX_JSON), to: '.' },
]),
],
// Loaders configuration -> ADDED IN THIS STEP
// We are telling webpack to use "babel-loader" for .js and .jsx files
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.ts?$/,
exclude: /node_modules/,
use: ['ts-loader'],
},
],
},
resolve: {
extensions: ['.js', '.ts', '.json'],
},
},
]