-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwebpack.config.js
More file actions
109 lines (107 loc) · 2.9 KB
/
Copy pathwebpack.config.js
File metadata and controls
109 lines (107 loc) · 2.9 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
109
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var IS_PRODUCTION = process.env.NODE_ENV === 'production';
var SRC_DIRECTORY = path.resolve(__dirname, 'src');
var BUILD_DIRECTORY = path.resolve(__dirname, "build");
var TEST_DIRECTORY = path.resolve(__dirname, "spec");
// this is the config for generating the files needed to run the examples.
module.exports = {
output: {
path: BUILD_DIRECTORY,
filename: "[name].js",
publicPath: IS_PRODUCTION ? undefined : "",
libraryTarget: IS_PRODUCTION ? 'commonjs2' : undefined,
},
devtool: IS_PRODUCTION ? null : 'eval',
entry: IS_PRODUCTION ? {
"pyret-ide": './src/pyret-ide',
} : {
"index": './src/dev-app/index.js',
"third-party": [
'babel-polyfill',
'immutable',
'react',
'react-dom',
'react-redux',
'redux',
'redux-thunk',
'redux-logger',
'redux-devtools',
],
},
externals: IS_PRODUCTION ? [
'react',
'react-dom',
'codemirror',
] : [],
resolve: {
root: [path.resolve("./node_modules")],
alias: {
'pyret-ide': SRC_DIRECTORY,
},
},
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'},
].concat(IS_PRODUCTION ? [] : [
{
test: /\.js$/,
include: [SRC_DIRECTORY],
loader: 'react-hot'
},
]),
preLoaders: [{
test: /\.js$/,
include: [
SRC_DIRECTORY,
TEST_DIRECTORY,
],
loaders: ["babel?cacheDirectory", "eslint"],
}].concat(
(process.env.COVERAGE || process.env.CONTINUOUS_INTEGRATION) ?
[{
test: /\.js/,
loader: 'isparta',
include: SRC_DIRECTORY,
exclude: /node_modules/
}] :
[]
),
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
].concat(IS_PRODUCTION ? [
] : [
new webpack.optimize.CommonsChunkPlugin({
name:'third-party',
minChunks: Infinity
}),
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin(),
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_DATABASE_URL': JSON.stringify(
process.env.FIREBASE_DATABASE_URL
),
}),
]),
devServer: IS_PRODUCTION ? false : {
hot: true,
inline: true,
progress: true,
contentBase: path.join(__dirname, 'src', 'dev-app')
}
};