mirror of
https://github.com/yldio/copilot.git
synced 2024-11-28 14:10:04 +02:00
handle aliases in webpack test
This commit is contained in:
parent
d055c3a540
commit
9376818a4b
@ -1,13 +1,32 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
const plugins = require('./plugins');
|
const plugins = require('./plugins');
|
||||||
|
const CONTEXT = path.join(__dirname, '../src');
|
||||||
|
const ROOT = path.join(__dirname, '../..');
|
||||||
|
|
||||||
module.exports = {
|
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: {
|
output: {
|
||||||
libraryTarget: 'commonjs2'
|
libraryTarget: 'commonjs2'
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
plugins['no-errors-plugin'],
|
plugins['no-errors'],
|
||||||
plugins['loader-options-plugin'],
|
plugins['loader-options'],
|
||||||
plugins['define-plugin']
|
plugins['define']
|
||||||
],
|
],
|
||||||
module: {
|
module: {
|
||||||
loaders: [{
|
loaders: [{
|
||||||
|
Loading…
Reference in New Issue
Block a user