'Babel (expo) avoid compiling some dev only packages
Currently I have to use some cookie jar to make axios work in jest.
axios.defaults.headers.post['Content-Type'] = 'application/json'
axios.defaults.headers.common.Accept = 'application/json'
axios.defaults.baseURL = Configuration.API_URL
axios.defaults.withCredentials = true
function getAxiosInstance() {
if (process.env.NODE_ENV === 'test') {
return wrapper(
axios.create({
jar: new CookieJar(),
})
)
}
return axios.create()
}
I would like to avoid babel not compile the axios-cookiejar-support and tough-cookie (and their required nodeJS dependencies).
but it's throwing:
iOS Bundling failed 8678ms
Unable to resolve module url from <REPO>/node_modules/tough-cookie/lib/cookie.js: url could not be found within the project or in these directories:
node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
31 | "use strict";
32 | const punycode = require("punycode");
> 33 | const urlParse = require("url").parse;
| ^
34 | const util = require("util");
35 | const pubsuffix = require("./pubsuffix-psl");
36 | const Store = require("./store").Store;
What is the best way to avoid that?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
