This repository has been archived by the owner on Aug 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
69 lines (66 loc) · 2.5 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* This is the Webpack configuration file. Webpack is used both as a task runner
* and also a module bundler. This is why we can use snazzy NodeJS-style `require`
* statements and also ES6 module definitions.
*/
const path = require('path');
module.exports = [
{
mode: 'production',
// name: 'client',
entry: {
app: ['./lib/main.js'], // This is the main file that gets loaded first; the "bootstrap", if you will.
},
output: { // Transpiled and bundled output gets put in `build/bundle.js`.
path: path.resolve(__dirname, 'build'),
publicPath: '/assets/', // But it gets served as "assets" for testing purposes.
filename: 'psipred.js', // Really, you want to upload index.html and assets/bundle.js
libraryTarget: 'var', // https://stackoverflow.com/questions/34357489/calling-webpacked-code-from-outside-html-script-tag
library: 'psipred',
},
// This makes it easier to debug scripts by listing line number of whichever file
// threw the exception or console.log or whathaveyounot.
devtool: 'inline-source-map',
module: {
rules: [{
test: /\.js?$/, // Another convention is to use the .es6 filetype, but you then
// have to supply that explicitly in import statements, which isn't cool.
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
},
// This nifty bit of magic right here allows us to load entire JSON files
// synchronously using `require`, just like in NodeJS.
{
test: /\.json$/,
loader: 'json-loader',
},
// This allows you to `require` CSS files.
// We be in JavaScript land here, baby! No <style> tags for us!
{
test: /\.css$/,
loader: 'style-loader!css-loader',
},
]
// loaders: [
// {
// test: /\.js?$/, // Another convention is to use the .es6 filetype, but you then
// // have to supply that explicitly in import statements, which isn't cool.
// exclude: /(node_modules|bower_components)/,
// loader: 'babel-loader',
// },
// // This nifty bit of magic right here allows us to load entire JSON files
// // synchronously using `require`, just like in NodeJS.
// {
// test: /\.json$/,
// loader: 'json-loader',
// },
// // This allows you to `require` CSS files.
// // We be in JavaScript land here, baby! No <style> tags for us!
// {
// test: /\.css$/,
// loader: 'style-loader!css-loader',
// },
// ],
},
},
];