-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpacker.js
More file actions
45 lines (39 loc) · 796 Bytes
/
webpacker.js
File metadata and controls
45 lines (39 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const pather = (path) => {
path = path.split('/')
path[0] = '__dirname'
return `path.resolve(${path})`
}
const ruler = (rules) => {
// rules: [
// { test: 'txt', use: 'raw-loader' },
// { test: /\.sass$/, loader: 'file-loader?name=../fonts/[name].[ext]' },
// ]
let final = []
rules.forEach(rule => {
let test = rule.test
test = '/\\.' + 'alma'
final.push({
test,
use: rule.use
})
})
const string = '/\\.' + 'alma'
return {string}
}
const webpacker = ({ entry, out }) => {
const config = {
entry: pather(entry),
output: {
filename: pather(out)
}
}
const final = module.exports = config
return final
}
console.log(webpacker(
{
entry: '/alma/index.js',
out: '/bundle/buncle.js'
}
))
console.log(ruler([{test: 'txt', use: 'raw-loader'}]))