Skip to content

Commit 84ec8e5

Browse files
jonathantnealevilebottnawi
authored andcommitted
fix: using inline style source maps (#383)
BREAKING CHANGE: `convertToAbsoluteUrls` option was removed, you don't need this anymore
1 parent 5ddb01b commit 84ec8e5

7 files changed

+226
-614
lines changed

README.md

-19
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ import url from 'file.css';
8282
<link rel="stylesheet" href="path/to/file.css" />
8383
```
8484

85-
> ℹ️ Source maps and assets referenced with `url`: when style loader is used with `{ options: { sourceMap: true } }` option, the CSS modules will be generated as `Blob`s, so relative paths don't work (they would be relative to `chrome:blob` or `chrome:devtools`). In order for assets to maintain correct paths setting `output.publicPath` property of webpack configuration must be set, so that absolute paths are generated. Alternatively you can enable the `convertToAbsoluteUrls` option mentioned above.
86-
8785
### `Useable`
8886

8987
The `style-loader` injects the styles lazily making them useable on-demand via `style.use()` / `style.unuse()`
@@ -145,7 +143,6 @@ Styles are not added on `import/require()`, but instead on call to `use`/`ref`.
145143
| **`insertInto`** | `{String\|Function}` | `<head>` | Inserts `<style></style>` into the given position |
146144
| **`singleton`** | `{Boolean}` | `undefined` | Reuses a single `<style></style>` element, instead of adding/removing individual elements for each required module. |
147145
| **`sourceMap`** | `{Boolean}` | `false` | Enable/Disable Sourcemaps |
148-
| **`convertToAbsoluteUrls`** | `{Boolean}` | `false` | Converts relative URLs to absolute urls, when source maps are enabled |
149146

150147
### `hmr`
151148

@@ -397,22 +394,6 @@ Enable/Disable source map loading
397394
}
398395
```
399396

400-
### `convertToAbsoluteUrls`
401-
402-
If convertToAbsoluteUrls and sourceMaps are both enabled, relative urls will be converted to absolute urls right before the css is injected into the page. This resolves [an issue](https://github.com/webpack/style-loader/pull/96) where relative resources fail to load when source maps are enabled. You can enable it with the convertToAbsoluteUrls option.
403-
404-
**webpack.config.js**
405-
406-
```js
407-
{
408-
loader: 'style-loader',
409-
options: {
410-
sourceMap: true,
411-
convertToAbsoluteUrls: true
412-
}
413-
}
414-
```
415-
416397
<h2 align="center">Maintainers</h2>
417398

418399
<table>

0 commit comments

Comments
 (0)