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

43 lines
973 B
JavaScript
Raw Normal View History

2016-12-06 13:14:48 +02:00
const path = require('path');
const fs = require('fs');
const plugins = require('./plugins');
2016-12-06 13:14:48 +02:00
const CONTEXT = path.join(__dirname, '../src');
const ROOT = path.join(__dirname, '../..');
2016-10-24 14:23:05 +03:00
module.exports = {
2016-12-06 13:14:48 +02:00
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-24 14:23:05 +03:00
output: {
2016-10-24 14:41:17 +03:00
libraryTarget: 'commonjs2'
2016-10-24 14:23:05 +03:00
},
plugins: [
2016-12-06 13:14:48 +02:00
plugins['no-errors'],
plugins['loader-options'],
plugins['define']
2016-10-24 14:23:05 +03:00
],
module: {
loaders: [{
test: /\.css?$/,
2016-10-26 12:51:06 +03:00
loader: [
'css-loader?',
'modules&importLoaders=1&',
'localIdentName=[name]__[local]___[hash:base64:5]!',
'postcss-loader'
].join('')
2016-10-24 14:23:05 +03:00
}]
}
2016-10-24 16:11:50 +03:00
};