1 | | I was using my own regex, but removed it now that django supports this natively. But I dont think Django's regex works with the following: |
2 | | |
3 | | {{{ |
4 | | import*as l from "/static/jsapp/jsapp/dtmod.min.js";import*as h from "/static/jsapp/jsapp/nummod.min.js";import*as m from "/static/leave/jsapp/fetcher.min.js";import {BaseComponent as g} from "/static/wcapp/jsapp/wc-base.min.425310100bce.js"; |
5 | | }}} |
6 | | |
7 | | As you can see only the 4th import was correctly altered, the first 3 werent even detected, (below is the same as above but placed the imports on seprate lines for readability): |
8 | | |
9 | | {{{ |
10 | | import*as l from "/static/jsapp/jsapp/dtmod.min.js"; |
11 | | import*as h from "/static/jsapp/jsapp/nummod.min.js"; |
12 | | import*as m from "/static/leave/jsapp/fetcher.min.js"; |
13 | | import {BaseComponent as g} from "/static/wcapp/jsapp/wc-base.min.425310100bce.js"; |
14 | | }}} |
15 | | |
16 | | |
17 | | This regex handles the missing case: |
18 | | {{{ |
19 | | ( |
20 | | r"""(?P<matched>(?P<import_as>import\s*\*as\s\S)+\s+from\s*["'](?P<url>[./].*?)["']\s*;)""", |
21 | | """%(import_as)s from "%(url)s";""", |
22 | | ), |
23 | | }}} |