Skip to content

Commit

Permalink
test(loader): Add test for the case when publicPath is an empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
rmja committed Apr 26, 2019
1 parent 8ae0739 commit 85643bb
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/cases/publicpath-emptystring/expected/main.css
@@ -0,0 +1,2 @@
body { background: red; background-image: url(cd0bb358c45b584743d8ce4991777c42.svg); }

1 change: 1 addition & 0 deletions test/cases/publicpath-emptystring/index.js
@@ -0,0 +1 @@
import './style.css';
1 change: 1 addition & 0 deletions test/cases/publicpath-emptystring/react.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/cases/publicpath-emptystring/style.css
@@ -0,0 +1 @@
body { background: red; background-image: url(./react.svg); }
37 changes: 37 additions & 0 deletions test/cases/publicpath-emptystring/webpack.config.js
@@ -0,0 +1,37 @@
import Self from '../../../src';

module.exports = {
entry: './index.js',
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: Self.loader,
options: {
publicPath: '',
},
},
'css-loader',
],
},
{
test: /\.(svg|png)$/,
use: [
{
loader: 'file-loader',
options: {
filename: '[name].[ext]',
},
},
],
},
],
},
plugins: [
new Self({
filename: '[name].css',
}),
],
};

0 comments on commit 85643bb

Please sign in to comment.