diff --git a/packages/beasties-webpack-plugin/src/index.js b/packages/beasties-webpack-plugin/src/index.js index 38b3f8a..e4dd3e2 100644 --- a/packages/beasties-webpack-plugin/src/index.js +++ b/packages/beasties-webpack-plugin/src/index.js @@ -175,7 +175,7 @@ export default class BeastiesWebpackPlugin extends Beasties { if (!sheet) { try { - sheet = await this.readFile(this.compilation, filename) + sheet = await this.readFile(filename) this.logger.warn( `Stylesheet "${relativePath}" not found in assets, but a file was located on disk.${ this.options.pruneSource diff --git a/packages/beasties-webpack-plugin/test/fixtures/fs-access/dist/style.css b/packages/beasties-webpack-plugin/test/fixtures/fs-access/dist/style.css new file mode 100644 index 0000000..7a75bb8 --- /dev/null +++ b/packages/beasties-webpack-plugin/test/fixtures/fs-access/dist/style.css @@ -0,0 +1 @@ +div.foo{color:red} diff --git a/packages/beasties-webpack-plugin/test/fixtures/fs-access/index.html b/packages/beasties-webpack-plugin/test/fixtures/fs-access/index.html new file mode 100644 index 0000000..5cfed2b --- /dev/null +++ b/packages/beasties-webpack-plugin/test/fixtures/fs-access/index.html @@ -0,0 +1,12 @@ + + + + + Access external stylesheet from FS + + +
+

Access external stylesheet from FS

+
+ + diff --git a/packages/beasties-webpack-plugin/test/fixtures/fs-access/index.js b/packages/beasties-webpack-plugin/test/fixtures/fs-access/index.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/beasties-webpack-plugin/test/index.test.ts b/packages/beasties-webpack-plugin/test/index.test.ts index 91eae0e..f858575 100644 --- a/packages/beasties-webpack-plugin/test/index.test.ts +++ b/packages/beasties-webpack-plugin/test/index.test.ts @@ -197,3 +197,13 @@ describe('options', () => { }) }) }) + +describe('accessing file system', () => { + it('works', async () => { + const output = await compileToHtml('fs-access', configure, { + path: 'dist', + publicPath: '', + }) + expect(output.html).toMatch(/\.foo/) + }) +})