File tree Expand file tree Collapse file tree 1 file changed +29
-4
lines changed Expand file tree Collapse file tree 1 file changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,36 @@ npm i -D sourcemap-publisher
1515npx sourcemap-publisher --provenance
1616```
1717
18- This will automatically detect which files you have in your ` files ` array
19- (` package.json ` ), and will look up the sourcemaps for them.
18+ This will do the following:
2019
21- Once it has these, it will publish the package to npm under a ` sourcemaps `
22- tag and rewrite the sourcemap URLs to point to the external location.
20+ - Load the files in your ` files ` array in ` package.json `
21+ - Find the sourcemaps any of these files reference
22+ - Package up these sourcemaps under ` {packageName}@{version}-sourcemaps `
23+ - Rewrite the sourcemap URLs in the original sources to point at a CDN for
24+ this sourcemap package
25+
26+ You should run this command ** after your build** , but ** before** you publish.
27+
28+ ## Example setup
29+
30+ It is important to get the ordering right so you do not overwrite the
31+ rewritten sourcemap URLs.
32+
33+ Generally, the order should be as follows:
34+
35+ - Build your package
36+ - Run ` sourcemap-publisher ` to publish the sourcemaps and rewrite the URLs
37+ - Run ` npm publish ` to publish the rewritten sources
38+
39+ You can achieve this through a ` prepublishOnly ` script in your ` package.json ` :
40+
41+ ``` json
42+ {
43+ "scripts" : {
44+ "prepublishOnly" : " npm run build && sourcemap-publisher --provenance"
45+ }
46+ }
47+ ```
2348
2449## Options
2550
You can’t perform that action at this time.
0 commit comments