2016-11-11 18:52:19 +00:00
|
|
|
/**
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var webpack = require('webpack');
|
|
|
|
|
|
|
|
var PROD = process.argv.indexOf('-p') !== -1
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
'context': __dirname,
|
|
|
|
entry: {
|
2017-01-13 21:37:02 +00:00
|
|
|
'Main': 'src/FeatureTest',
|
2016-11-11 18:52:19 +00:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
filename: './build/[name].js',
|
|
|
|
chunkFilename: './build/[id].js',
|
|
|
|
sourceMapFilename : '[file].map',
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
root: __dirname,
|
2017-01-13 21:37:02 +00:00
|
|
|
modulesDirectories : ['node_modules', 'src', 'third_party', 'node_modules/tone', 'style'],
|
2016-11-11 18:52:19 +00:00
|
|
|
},
|
|
|
|
plugins: PROD ? [
|
|
|
|
new webpack.optimize.UglifyJsPlugin({minimize: true})
|
|
|
|
] : [],
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
2017-01-13 21:37:02 +00:00
|
|
|
exclude: /(node_modules|Tone\.js)/,
|
2016-11-11 18:52:19 +00:00
|
|
|
loader: 'babel', // 'babel-loader' is also a valid name to reference
|
|
|
|
query: {
|
|
|
|
presets: ['es2015']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
loader: 'style!css!autoprefixer!sass'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.json$/,
|
|
|
|
loader: 'json-loader'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|gif|svg)$/,
|
|
|
|
loader: 'url-loader',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test : /\.(ttf|eot|woff(2)?)(\?[a-z0-9]+)?$/,
|
|
|
|
loader : 'file-loader?name=images/font/[hash].[ext]'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
devtool: PROD ? '' : '#eval-source-map'
|
|
|
|
};
|