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,
|
2017-12-30 20:29:04 +00:00
|
|
|
debug: !isProd,
|
2017-07-04 03:28:56 +00:00
|
|
|
options: {
|
|
|
|
// css-loader relies on context
|
2017-09-25 02:06:28 +00:00
|
|
|
context: process.cwd()
|
2017-04-12 04:59:58 +00:00
|
|
|
}
|
2017-07-04 03:28:56 +00:00
|
|
|
};
|
|
|
|
};
|