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

43 lines
973 B
JavaScript

const path = require('path');
const fs = require('fs');
const plugins = require('./plugins');
const CONTEXT = path.join(__dirname, '../src');
const ROOT = path.join(__dirname, '../..');
module.exports = {
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
})
},
output: {
libraryTarget: 'commonjs2'
},
plugins: [
plugins['no-errors'],
plugins['loader-options'],
plugins['define']
],
module: {
loaders: [{
test: /\.css?$/,
loader: [
'css-loader?',
'modules&importLoaders=1&',
'localIdentName=[name]__[local]___[hash:base64:5]!',
'postcss-loader'
].join('')
}]
}
};