-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
66 lines (56 loc) · 1.58 KB
/
index.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const mix = require('laravel-mix');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const bladeLoader = require.resolve('./loader');
class SingleFileBladeComponent {
register(src, target) {
mix.js(src, target);
}
webpackRules() {
return [{
test: /\.blade.php$/,
use: [
{
loader: 'vue-loader',
options: Config.vue || {}
},
{
loader: bladeLoader
}
]
},
{
resourceQuery: /blockType=x-template/,
use: [{
loader: bladeLoader,
options: {
type: 'x-template'
}
}]
},
{
resourceQuery: /xbType=style/,
use: [{
loader: MiniCssExtractPlugin.loader,
options: {
esModule: false,
}
}]
}
];
}
webpackPlugins() {
return [new MiniCssExtractPlugin(Config.miniCssExtractPlugin || {})];
}
webpackConfig(config) {
const pitcher = {
loader: require.resolve('./pitcher'),
resourceQuery: /xbType=style/,
};
config.module.rules = [
pitcher,
...config.module.rules
];
}
}
mix.extend('singleFileBladeComponent', new SingleFileBladeComponent());
mix.extend('sfbc', new SingleFileBladeComponent());