Skip to content

Commit

Permalink
STRWEB-109 allow loading of arbitrary text files (#145)
Browse files Browse the repository at this point in the history
Support `?raw` to load arbitrary text files as strings, permitting, for
example, a large XSLT file to be easily imported.

Usage:
```
import txtFile from "./someTxtFile.txt?raw"
```

Refs STRWEB-109
  • Loading branch information
zburke authored Oct 2, 2024
1 parent 9db3b60 commit 1c4df2b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Don't worry about the order of CSS imports across modules. Refs STRWEB-110.
* Remove postcss-plugins: postcss-nesting, postcss-custom-properties, postcss-color-function, postcss-calc. Add CSS variables entry point in webpack config. Refs STRWEB-111.
* Support import of arbitrary text files via `?raw`. Refs STRWEB-109.

## [5.1.0](https://github.com/folio-org/stripes-webpack/tree/v5.1.0) (2024-03-12)
[Full Changelog](https://github.com/folio-org/stripes-webpack/compare/v5.0.0...v5.1.0)
Expand Down
10 changes: 10 additions & 0 deletions webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ const baseConfig = {
resourceQuery: /icon/, // stcom icons use this query on the resource.
use: ['@svgr/webpack']
},
// allow import of arbitrary files as strings by appending `?raw` to the import.
// use it like:
// import someString from "./someTxtFile.txt?raw"
// see https://github.com/webpack/webpack/discussions/16775#discussioncomment-5233250
// see https://webpack.js.org/guides/asset-modules/
// this facilitates importing large files as strings, e.g. XSLT
{
type: 'asset/source',
resourceQuery: /raw/,
},
],
},
};
Expand Down

0 comments on commit 1c4df2b

Please sign in to comment.