Skip to content

Commit

Permalink
build: update the build target to support webpack based frameworks
Browse files Browse the repository at this point in the history
fix #179
  • Loading branch information
Stun3R committed Aug 15, 2023
1 parent 5c402b3 commit e8c10ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default [
}),
commonjs({ include: /node_modules/ }),
esbuild({
target: "esnext",
target: "es2018",
}),
json(),
],
Expand Down
15 changes: 10 additions & 5 deletions src/lib/strapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import axios, {
import defu from "defu";
import qs from "qs";
import Cookies from "js-cookie";
import { cleanDoubleSlashes, joinURL } from "ufo";
import ufo from "ufo";

// Load custom types
import type {
Expand Down Expand Up @@ -66,13 +66,13 @@ export class Strapi {
// clean url & prefix
this.options = {
..._options,
url: cleanDoubleSlashes(_options?.url),
prefix: cleanDoubleSlashes(_options?.prefix),
url: ufo.cleanDoubleSlashes(_options?.url),
prefix: ufo.cleanDoubleSlashes(_options?.prefix),
};

// create axios instance
this.axios = axios.create({
baseURL: joinURL(this.options.url, this.options.prefix),
baseURL: ufo.joinURL(this.options.url, this.options.prefix),
paramsSerializer: qs.stringify,
...this.options.axiosOptions,
});
Expand Down Expand Up @@ -261,7 +261,12 @@ export class Strapi {
* @returns string
*/
public getProviderAuthenticationUrl(provider: StrapiAuthProvider): string {
return joinURL(this.options.url, this.options.prefix, "connect", provider);
return ufo.joinURL(
this.options.url,
this.options.prefix,
"connect",
provider
);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
"compilerOptions": {
"module": "esnext",
"lib": ["dom", "esnext"],
"target": "esnext",
"lib": ["dom", "ES2018"],
"target": "ES2018",
"importHelpers": true,
// output .d.ts declaration files for consumers
"declaration": true,
Expand Down

0 comments on commit e8c10ef

Please sign in to comment.