2017-07-04 03:28:56 +00:00
|
|
|
'use strict';
|
|
|
|
const path = require('path');
|
|
|
|
const config = require('./config');
|
2017-04-12 04:59:58 +00:00
|
|
|
|
2017-07-04 03:28:56 +00:00
|
|
|
const _ = (module.exports = {});
|
2017-04-12 04:59:58 +00:00
|
|
|
|
2017-07-04 03:28:56 +00:00
|
|
|
_.cwd = file => {
|
|
|
|
return path.join(process.cwd(), file || '');
|
|
|
|
};
|
2017-04-12 04:59:58 +00:00
|
|
|
|
2017-07-04 03:28:56 +00:00
|
|
|
_.outputPath = path.join(__dirname, '../dist');
|
2017-04-12 04:59:58 +00:00
|
|
|
|
2017-07-04 03:28:56 +00:00
|
|
|
_.outputIndexPath = path.join(__dirname, '../dist/index.html');
|
2017-04-12 04:59:58 +00:00
|
|
|
|
2017-07-04 03:28:56 +00:00
|
|
|
_.target = 'web';
|
2017-04-12 04:59:58 +00:00
|
|
|
|
|
|
|
_.loadersOptions = () => {
|
2017-07-04 03:28:56 +00:00
|
|
|
const isProd = process.env.NODE_ENV === 'production';
|
2017-04-12 04:59:58 +00:00
|
|
|
|
2017-07-04 03:28:56 +00:00
|
|
|
return {
|
|
|
|
minimize: isProd,
|
|
|
|
options: {
|
|
|
|
// css-loader relies on context
|
|
|
|
context: process.cwd(),
|
|
|
|
babel: config.babel
|
2017-04-12 04:59:58 +00:00
|
|
|
}
|
2017-07-04 03:28:56 +00:00
|
|
|
};
|
|
|
|
};
|