Skip to content

Commit 55fb9fb

Browse files
committed
Add new test case for project with CSS modules
1 parent e44890f commit 55fb9fb

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

packages/dependency-extraction-webpack-plugin/test/__snapshots__/build.js.snap

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,29 @@ Array [
244244
]
245245
`;
246246

247+
exports[`DependencyExtractionWebpackPlugin Webpack \`style-imports\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `
248+
"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => '87d097ece7eeb99faa63');
249+
"
250+
`;
251+
252+
exports[`DependencyExtractionWebpackPlugin Webpack \`style-imports\` should produce expected output: External modules should match snapshot 1`] = `
253+
Array [
254+
Object {
255+
"externalType": "window",
256+
"request": "lodash",
257+
"userRequest": "lodash",
258+
},
259+
Object {
260+
"externalType": "window",
261+
"request": Array [
262+
"wp",
263+
"blob",
264+
],
265+
"userRequest": "@wordpress/blob",
266+
},
267+
]
268+
`;
269+
247270
exports[`DependencyExtractionWebpackPlugin Webpack \`wordpress\` should produce expected output: Asset file 'main.asset.php' should match snapshot 1`] = `
248271
"<?php return array('dependencies' => array('lodash', 'wp-blob'), 'version' => '4c78134607e6ed966df3');
249272
"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* WordPress dependencies
3+
*/
4+
import { isBlobURL } from '@wordpress/blob';
5+
6+
/**
7+
* External dependencies
8+
*/
9+
import _ from 'lodash';
10+
11+
/**
12+
* Internal dependencies
13+
*/
14+
import './style.css';
15+
16+
_.isEmpty( isBlobURL( '' ) );
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
body { color: white; }
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* External dependencies
3+
*/
4+
const MiniCSSExtractPlugin = require( 'mini-css-extract-plugin' );
5+
6+
/**
7+
* Internal dependencies
8+
*/
9+
const DependencyExtractionWebpackPlugin = require( '../../..' );
10+
11+
module.exports = {
12+
plugins: [
13+
new DependencyExtractionWebpackPlugin(),
14+
new MiniCSSExtractPlugin(),
15+
],
16+
module: {
17+
rules: [
18+
{
19+
test: /\.css$/,
20+
use: [
21+
{
22+
loader: MiniCSSExtractPlugin.loader,
23+
},
24+
{
25+
loader: require.resolve( 'css-loader' ),
26+
},
27+
],
28+
},
29+
],
30+
},
31+
};

0 commit comments

Comments
 (0)