1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-11 05:40:11 +02:00
copilot/frontend/webpack/base.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-10-20 04:14:26 +03:00
const path = require('path');
const fs = require('fs');
2016-10-20 04:14:26 +03:00
const plugins = require('./plugins');
const CONTEXT = path.join(__dirname, '../src');
const STATIC = path.join(__dirname, '../static');
const ROOT = path.join(__dirname, '../..');
2016-10-24 14:23:05 +03:00
module.exports = {
context: CONTEXT,
resolve: {
modules: [
ROOT,
'node_modules'
],
alias: fs.readdirSync(CONTEXT)
.map((name) => path.join(CONTEXT, name))
.filter((fullpath) => fs.statSync(fullpath).isDirectory())
.reduce((aliases, fullpath) => Object.assign(aliases, {
[`@${path.basename(fullpath)}`]: fullpath
}), {
'@root': CONTEXT
})
},
2016-10-20 04:14:26 +03:00
output: {
path: STATIC,
2016-10-20 04:14:26 +03:00
publicPath: '/static/',
2016-12-12 12:56:48 +02:00
filename: '[name].js'
2016-10-20 04:14:26 +03:00
},
plugins: [
plugins['no-errors'],
plugins['define'],
plugins['shell']
2016-10-20 04:14:26 +03:00
],
module: {
loaders: [{
test: /js?$/,
exclude: /node_modules/,
include: [CONTEXT],
loaders: ['babel-loader']
2016-10-20 04:14:26 +03:00
}, {
test: /\.json?$/,
exclude: /node_modules/,
include: [CONTEXT],
loaders: ['json-loader']
}]
2016-10-20 04:14:26 +03:00
}
};