Skip to content

Commit 5db65d2

Browse files
committed
test: publicPath function
1 parent 098a268 commit 5db65d2

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
body { background: red; background-image: url(../cd0bb358c45b584743d8ce4991777c42.svg); }
2+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './nested/style.css';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
body { background: red; background-image: url(../react.svg); }
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const Self = require('../../../');
2+
const path = require('path')
3+
4+
module.exports = {
5+
entry: './index.js',
6+
module: {
7+
rules: [
8+
{
9+
test: /\.css$/,
10+
use: [
11+
{
12+
loader: Self.loader,
13+
options: {
14+
publicPath: (resourcePath, context) => path.relative(path.dirname(resourcePath), context) + '/',
15+
}
16+
},
17+
'css-loader',
18+
],
19+
}, {
20+
test: /\.(svg|png)$/,
21+
use: [{
22+
loader: 'file-loader',
23+
options: {
24+
filename: '[name].[ext]'
25+
}
26+
}]
27+
}
28+
],
29+
},
30+
plugins: [
31+
new Self({
32+
filename: '[name].css',
33+
}),
34+
],
35+
};

0 commit comments

Comments
 (0)