forked from brownplt/code.pyret.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
91 lines (88 loc) · 2.78 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
var path = require('path');
var fs = require('fs');
var webpack = webpack = require('webpack');
var IS_PRODUCTION = process.env.NODE_ENV == 'production';
var SRC_DIRECTORY = path.resolve(__dirname, 'src');
var IDE_SRC_DIRECTORY = path.resolve(__dirname, 'node_modules', 'pyret-ide', 'src');
module.exports = {
output: {
path: path.resolve(__dirname, "build", "web"),
filename: "[name].js",
publicPath: IS_PRODUCTION ? undefined : process.env.ASSET_BASE_URL+"/",
},
devtool: IS_PRODUCTION ? 'source-map' : 'inline-source-map',
entry: {
"js/beforePyret": './src/web/js/beforePyret.js',
"js/ide": './src/web/js/ide.js',
},
module: {
loaders: [
{test: /\.css$/, loaders: ["style", "css"]},
{test:/.png|.jpg|.jpeg|.gif|.svg/, loader: "url-loader?limit=10000"},
{test:/.woff|.woff2/, loader: "url-loader?limit=10000"},
{test:/.woff|.woff2/, loader: "url-loader?limit=10000"},
{test:/.ttf|.eot/, loader: "file-loader"},
{test: /\.less$/, loader:'style!css!less'},
],
preLoaders: [{
test: /\.js$/,
include: [
SRC_DIRECTORY,
// for some reason, webpack doesn't know how to deal with symlinks
// when deciding which loaders to use
fs.realpathSync(IDE_SRC_DIRECTORY),
],
loader: "babel",
query: {
cacheDirectory: true
}
}].concat(
(process.env.COVERAGE || process.env.CONTINUOUS_INTEGRATION) ?
[{
test: /\.js/,
loader: 'isparta',
include: SRC_DIRECTORY,
exclude: /node_modules/
}] :
[]
),
},
resolve: {
root: [path.resolve("./node_modules")],
alias: {
'pyret-ide': path.resolve(IDE_SRC_DIRECTORY, 'pyret-ide'),
},
},
plugins: [
new webpack.DefinePlugin({
'process.env.FIREBASE_API_KEY': JSON.stringify(process.env.FIREBASE_API_KEY),
'process.env.FIREBASE_AUTH_DOMAIN': JSON.stringify(process.env.FIREBASE_AUTH_DOMAIN),
'process.env.FIREBASE_DB_URL': JSON.stringify(process.env.FIREBASE_DB_URL),
'process.env.FIREBASE_BUCKET': JSON.stringify(process.env.FIREBASE_BUCKET),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.PYRET': JSON.stringify(process.env.PYRET),
'process.env.BASE_URL': JSON.stringify(process.env.BASE_URL),
'process.env.CURRENT_PYRET_RELEASE': JSON.stringify(process.env.CURRENT_PYRET_RELEASE),
}),
].concat(IS_PRODUCTION ? [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
] : [
new webpack.HotModuleReplacementPlugin(),
]),
devServer: IS_PRODUCTION ? false : {
inline: true,
hot: true,
progress: true,
port: 5001,
proxy: {
"/**": {
target: 'http://localhost:5000',
}
}
},
progress: true
};