-
Notifications
You must be signed in to change notification settings - Fork 774
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support wrangler 1.x module specifiers with a deprecation warning
This implements wrangler 1.x style module specifiers, but also logs a deprecation warning for every usage. Consider a project like so: ``` project ├── index.js └── some-dependency.js ``` where the content of `index.js` is: ```jsx import SomeDependency from "some-dependency.js"; addEventListener("fetch", (event) => { // ... }); ``` `wrangler` 1.x would resolve `import SomeDependency from "some-dependency.js";` to the file `some-dependency.js`. This will work in `wrangler` v2, but it will log a deprecation warning. Instead, you should rewrite the import to specify that it's a relative path, like so: ```diff - import SomeDependency from "some-dependency.js"; + import SomeDependency from "./some-dependency.js"; ``` In a near future version, this will become a breaking deprecation and throw an error. (This also updates `workers-chat-demo` to use the older style specifier, since that's how it currently is at https://github.com/cloudflare/workers-chat-demo) Closes #586
- Loading branch information
1 parent
1cb7ae2
commit 1c872cd
Showing
5 changed files
with
128 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
"wrangler": patch | ||
--- | ||
|
||
feat: support wrangler 1.x module specifiers with a deprecation warning | ||
|
||
This implements wrangler 1.x style module specifiers, but also logs a deprecation warning for every usage. | ||
|
||
Consider a project like so: | ||
|
||
``` | ||
project | ||
├── index.js | ||
└── some-dependency.js | ||
``` | ||
|
||
where the content of `index.js` is: | ||
|
||
```jsx | ||
import SomeDependency from "some-dependency.js"; | ||
addEventListener("fetch", (event) => { | ||
// ... | ||
}); | ||
``` | ||
|
||
`wrangler` 1.x would resolve `import SomeDependency from "some-dependency.js";` to the file `some-dependency.js`. This will work in `wrangler` v2, but it will log a deprecation warning. Instead, you should rewrite the import to specify that it's a relative path, like so: | ||
|
||
```diff | ||
- import SomeDependency from "some-dependency.js"; | ||
+ import SomeDependency from "./some-dependency.js"; | ||
``` | ||
|
||
In a near future version, this will become a breaking deprecation and throw an error. | ||
|
||
(This also updates `workers-chat-demo` to use the older style specifier, since that's how it currently is at https://github.com/cloudflare/workers-chat-demo) | ||
|
||
Closes https://github.com/cloudflare/wrangler2/issues/586 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters