@tamagui/next-plugin 1.0.0-alpha.4 → 1.0.0-alpha.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +22 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/{index.cjs → cjs/withTamagui.js} +53 -37
- package/dist/cjs/withTamagui.js.map +7 -0
- package/dist/{index.js → esm/index.js} +0 -0
- package/dist/{index.js.map → esm/index.js.map} +1 -1
- package/dist/{withTamagui.js → esm/withTamagui.js} +35 -21
- package/dist/esm/withTamagui.js.map +7 -0
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/withTamagui.js +168 -0
- package/package.json +17 -12
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -0
- package/types/withTamagui.d.ts +3 -0
- package/types/withTamagui.d.ts.map +1 -0
- package/dist/index.cjs.map +0 -7
- package/dist/withTamagui.js.map +0 -7
- package/src/index.ts +0 -1
- package/src/withTamagui.ts +0 -206
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
6
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
7
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(module2))
|
|
9
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
10
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return target;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
15
|
+
return (module2, temp) => {
|
|
16
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
17
|
+
};
|
|
18
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
19
|
+
var src_exports = {};
|
|
20
|
+
__reExport(src_exports, require("./withTamagui"));
|
|
21
|
+
module.exports = __toCommonJS(src_exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -24,41 +24,50 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
24
24
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
25
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
26
26
|
var __export = (target, all) => {
|
|
27
|
-
__markAsModule(target);
|
|
28
27
|
for (var name in all)
|
|
29
28
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
30
29
|
};
|
|
31
|
-
var __reExport = (target, module2, desc) => {
|
|
30
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
32
31
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
33
32
|
for (let key of __getOwnPropNames(module2))
|
|
34
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
33
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
35
34
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
36
35
|
}
|
|
37
36
|
return target;
|
|
38
37
|
};
|
|
39
|
-
var
|
|
40
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default",
|
|
38
|
+
var __toESM = (module2, isNodeMode) => {
|
|
39
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
41
40
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
42
|
+
return (module2, temp) => {
|
|
43
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
44
|
+
};
|
|
45
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
46
|
+
var withTamagui_exports = {};
|
|
47
|
+
__export(withTamagui_exports, {
|
|
45
48
|
withTamagui: () => withTamagui
|
|
46
49
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var
|
|
50
|
+
var import_path = __toESM(require("path"));
|
|
51
|
+
var import_browserslist = __toESM(require("browserslist"));
|
|
52
|
+
var import_css_minimizer_webpack_plugin = __toESM(require("css-minimizer-webpack-plugin"));
|
|
53
|
+
var import_css = require("next/dist/build/webpack/config/blocks/css");
|
|
54
|
+
var import_loaders = require("next/dist/build/webpack/config/blocks/css/loaders");
|
|
55
|
+
var import_webpack = __toESM(require("webpack"));
|
|
56
|
+
const withTamagui = /* @__PURE__ */ __name((tamaguiOptions) => {
|
|
53
57
|
return (nextConfig = {}) => {
|
|
54
58
|
return Object.assign({}, nextConfig, {
|
|
55
59
|
webpack: (webpackConfig, options) => {
|
|
56
|
-
|
|
60
|
+
var _a;
|
|
61
|
+
const { dir, config, dev, isServer } = options;
|
|
62
|
+
const jsxRuntime = require.resolve("react/jsx-runtime.js");
|
|
63
|
+
const jsxDevRuntime = require.resolve("react/jsx-dev-runtime.js");
|
|
57
64
|
webpackConfig.resolve.alias = __spreadProps(__spreadValues({}, webpackConfig.resolve.alias || {}), {
|
|
65
|
+
"react/jsx-runtime.js": jsxRuntime,
|
|
66
|
+
"react/jsx-runtime": jsxRuntime,
|
|
67
|
+
"react/jsx-dev-runtime.js": jsxDevRuntime,
|
|
68
|
+
"react/jsx-dev-runtime": jsxDevRuntime,
|
|
58
69
|
"react-native$": "react-native-web",
|
|
59
70
|
"react-native-web/src/modules/normalizeColor": require.resolve("react-native-web/dist/cjs/modules/normalizeColor"),
|
|
60
|
-
"react/jsx-runtime": require.resolve("react/jsx-runtime"),
|
|
61
|
-
"react/jsx-dev-runtime": require.resolve("react/jsx-dev-runtime"),
|
|
62
71
|
react: require.resolve("react"),
|
|
63
72
|
"react-dom": require.resolve("react-dom")
|
|
64
73
|
});
|
|
@@ -79,7 +88,7 @@ var withTamagui = /* @__PURE__ */ __name((tamaguiOptions) => {
|
|
|
79
88
|
webpackConfig.resolve.extensions = [".web.js", ...webpackConfig.resolve.extensions];
|
|
80
89
|
}
|
|
81
90
|
webpackConfig.resolve.mainFields.unshift("module:jsx");
|
|
82
|
-
const isWebpack5 = !!config.future.webpack5 || typeof config.webpack5 === "undefined";
|
|
91
|
+
const isWebpack5 = !!((_a = config.future) == null ? void 0 : _a.webpack5) || typeof config.webpack5 === "undefined";
|
|
83
92
|
const includeModule = /* @__PURE__ */ __name((context, request) => {
|
|
84
93
|
const fullPath = request[0] === "." ? import_path.default.join(context, request) : request;
|
|
85
94
|
if (/^\@?react-native-/.test(request)) {
|
|
@@ -128,40 +137,34 @@ var withTamagui = /* @__PURE__ */ __name((tamaguiOptions) => {
|
|
|
128
137
|
if (oneOfRule) {
|
|
129
138
|
if (!dev) {
|
|
130
139
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
131
|
-
oneOfRule.oneOf
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
];
|
|
140
|
+
oneOfRule.oneOf.unshift({
|
|
141
|
+
test: /\.css$/i,
|
|
142
|
+
use: [MiniCssExtractPlugin.loader, "css-loader"],
|
|
143
|
+
sideEffects: true
|
|
144
|
+
});
|
|
138
145
|
const idx = webpackConfig.plugins.findIndex((x) => x.constructor.name === "NextMiniCssExtractPlugin");
|
|
139
146
|
webpackConfig.plugins.splice(idx, 1, new MiniCssExtractPlugin({
|
|
140
147
|
filename: "static/css/[name].[contenthash].css",
|
|
141
148
|
ignoreOrder: true
|
|
142
149
|
}));
|
|
143
150
|
} else {
|
|
144
|
-
const {
|
|
145
|
-
getGlobalCssLoader
|
|
146
|
-
} = require("next/dist/build/webpack/config/blocks/css/loaders");
|
|
147
151
|
oneOfRule.oneOf.unshift({
|
|
148
152
|
test: /\.css$/i,
|
|
149
153
|
sideEffects: true,
|
|
150
|
-
use: getGlobalCssLoader({
|
|
151
|
-
assetPrefix: options.config.assetPrefix,
|
|
152
|
-
future:
|
|
154
|
+
use: (0, import_loaders.getGlobalCssLoader)({
|
|
155
|
+
assetPrefix: options.config.assetPrefix || config.assetPrefix,
|
|
156
|
+
future: nextConfig.future,
|
|
157
|
+
experimental: nextConfig.experimental || {},
|
|
153
158
|
isClient: !isServer,
|
|
154
159
|
isServer,
|
|
155
160
|
isDevelopment: true
|
|
156
|
-
},
|
|
161
|
+
}, () => (0, import_css.lazyPostCSS)(dir, getSupportedBrowsers(dir, dev)), [])
|
|
157
162
|
});
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
165
|
const shouldExclude = /* @__PURE__ */ __name((x) => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
return true;
|
|
166
|
+
const shouldInclude = x.includes(options.dir) || tamaguiOptions.components.some((c) => x.includes(`/node_modules/${c}`) || x.includes(`${c}/dist/jsx/`));
|
|
167
|
+
return !shouldInclude;
|
|
165
168
|
}, "shouldExclude");
|
|
166
169
|
const [first, second, ...rest] = webpackConfig.module.rules;
|
|
167
170
|
webpackConfig.module.rules = [
|
|
@@ -194,4 +197,17 @@ var withTamagui = /* @__PURE__ */ __name((tamaguiOptions) => {
|
|
|
194
197
|
});
|
|
195
198
|
};
|
|
196
199
|
}, "withTamagui");
|
|
197
|
-
|
|
200
|
+
function getSupportedBrowsers(dir, isDevelopment) {
|
|
201
|
+
let browsers;
|
|
202
|
+
try {
|
|
203
|
+
browsers = import_browserslist.default.loadConfig({
|
|
204
|
+
path: dir,
|
|
205
|
+
env: isDevelopment ? "development" : "production"
|
|
206
|
+
});
|
|
207
|
+
} catch {
|
|
208
|
+
}
|
|
209
|
+
return browsers;
|
|
210
|
+
}
|
|
211
|
+
__name(getSupportedBrowsers, "getSupportedBrowsers");
|
|
212
|
+
module.exports = __toCommonJS(withTamagui_exports);
|
|
213
|
+
//# sourceMappingURL=withTamagui.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/withTamagui.ts"],
|
|
4
|
+
"sourcesContent": ["import path from 'path'\n\nimport { TamaguiOptions } from '@tamagui/static'\nimport browserslist from 'browserslist'\nimport CssMinimizerPlugin from 'css-minimizer-webpack-plugin'\nimport { lazyPostCSS } from 'next/dist/build/webpack/config/blocks/css'\nimport { getGlobalCssLoader } from 'next/dist/build/webpack/config/blocks/css/loaders'\nimport webpack from 'webpack'\n\nexport const withTamagui = (tamaguiOptions: TamaguiOptions) => {\n return (nextConfig: any = {}) => {\n return Object.assign({}, nextConfig, {\n webpack: (webpackConfig: any, options) => {\n const { dir, config, dev, isServer } = options\n\n // fixes https://github.com/kentcdodds/mdx-bundler/issues/143\n const jsxRuntime = require.resolve('react/jsx-runtime.js')\n const jsxDevRuntime = require.resolve('react/jsx-dev-runtime.js')\n\n webpackConfig.resolve.alias = {\n ...(webpackConfig.resolve.alias || {}),\n 'react/jsx-runtime.js': jsxRuntime,\n 'react/jsx-runtime': jsxRuntime,\n 'react/jsx-dev-runtime.js': jsxDevRuntime,\n 'react/jsx-dev-runtime': jsxDevRuntime,\n 'react-native$': 'react-native-web',\n 'react-native-web/src/modules/normalizeColor': require.resolve(\n 'react-native-web/dist/cjs/modules/normalizeColor'\n ),\n react: require.resolve('react'),\n 'react-dom': require.resolve('react-dom'),\n }\n\n webpackConfig.plugins.push(\n new webpack.DefinePlugin({\n 'process.env.TAMAGUI_TARGET': '\"web\"',\n })\n )\n\n if (process.env.IGNORE_TS_CONFIG_PATHS) {\n console.log('ignoring tsconfig paths, they mess up transpile')\n delete webpackConfig.resolve.plugins[0].paths['@tamagui/*']\n delete webpackConfig.resolve.plugins[0].paths['tamagui']\n }\n\n // TODO document and make configurable\n // replace minifier with css-minimizer-webpack-plugin which handles deduping atomic styles\n const cssMin = webpackConfig.optimization.minimizer.find((x) =>\n x.toString().includes('css-minimizer-plugin')\n )\n if (cssMin) {\n webpackConfig.optimization.minimizer = webpackConfig.optimization.minimizer.slice(\n cssMin.index,\n 1\n )\n }\n webpackConfig.optimization.minimizer.push(new CssMinimizerPlugin())\n\n if (!webpackConfig.resolve.extensions.includes('.web.js')) {\n webpackConfig.resolve.extensions = ['.web.js', ...webpackConfig.resolve.extensions]\n }\n\n // look for compiled js with jsx intact as specified by module:jsx\n webpackConfig.resolve.mainFields.unshift('module:jsx')\n\n const isWebpack5 = !!config.future?.webpack5 || typeof config.webpack5 === 'undefined'\n\n const includeModule = (context: string, request: string) => {\n const fullPath = request[0] === '.' ? path.join(context, request) : request\n if (/^\\@?react-native-/.test(request)) {\n return false\n }\n if (\n fullPath.startsWith('react-native-web') ||\n fullPath.includes('node_modules/react-native-web')\n ) {\n return `commonjs ${fullPath}`\n }\n if (/^(react-dom|react)$/.test(fullPath)) {\n return `commonjs ${fullPath}`\n }\n return true\n }\n\n if (isServer) {\n // externalize react native things from bundle\n webpackConfig.externals = [\n ...webpackConfig.externals.map((external) => {\n if (typeof external !== 'function') {\n return external\n }\n // only runs on server\n if (isWebpack5) {\n return (ctx, cb) => {\n const res = includeModule(ctx.context, ctx.request)\n if (typeof res === 'string') {\n return cb(null, res)\n }\n if (res) {\n return external(ctx, cb)\n }\n return cb()\n }\n }\n return (ctx, req, cb) => {\n const res = includeModule(ctx, req)\n if (typeof res === 'string') {\n return cb(null, res)\n }\n if (res) {\n return external(ctx, cb)\n }\n return cb()\n }\n }),\n ]\n }\n\n const oneOfRule = webpackConfig.module.rules.find((x) => !!x.oneOf)\n\n if (oneOfRule) {\n if (!dev) {\n // replace nextjs picky style rules with simple minicssextract\n const MiniCssExtractPlugin = require('mini-css-extract-plugin')\n oneOfRule.oneOf.unshift({\n test: /\\.css$/i,\n use: [MiniCssExtractPlugin.loader, 'css-loader'],\n sideEffects: true,\n })\n const idx = webpackConfig.plugins.findIndex(\n (x) => x.constructor.name === 'NextMiniCssExtractPlugin'\n )\n webpackConfig.plugins.splice(\n idx,\n 1,\n new MiniCssExtractPlugin({\n filename: 'static/css/[name].[contenthash].css',\n ignoreOrder: true,\n })\n )\n } else {\n oneOfRule.oneOf.unshift({\n test: /\\.css$/i,\n sideEffects: true,\n use: getGlobalCssLoader(\n // @ts-ignore\n {\n assetPrefix: options.config.assetPrefix || config.assetPrefix,\n future: nextConfig.future,\n experimental: nextConfig.experimental || {},\n isClient: !isServer,\n isServer,\n isDevelopment: true,\n },\n // @ts-ignore\n () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)),\n []\n ),\n })\n }\n }\n\n // add loader\n const shouldExclude = (x) => {\n // analyze everything in our src dir\n // analyze everything in the components dirs\n const shouldInclude =\n x.includes(options.dir) ||\n tamaguiOptions.components.some(\n (c) => x.includes(`/node_modules/${c}`) || x.includes(`${c}/dist/jsx/`)\n )\n\n return !shouldInclude\n }\n const [first, second, ...rest] = webpackConfig.module.rules\n webpackConfig.module.rules = [\n first,\n second,\n {\n test: /\\.(tsx|js|mjs|jsx)$/,\n exclude: shouldExclude,\n use: [\n {\n loader: 'esbuild-loader',\n options: {\n loader: 'tsx',\n minify: false,\n },\n },\n {\n loader: 'tamagui-loader',\n options: tamaguiOptions,\n },\n ],\n },\n ...rest,\n ]\n\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(webpackConfig, options)\n }\n\n return webpackConfig\n },\n })\n }\n}\n\nfunction getSupportedBrowsers(dir, isDevelopment) {\n let browsers\n try {\n browsers = browserslist.loadConfig({\n path: dir,\n env: isDevelopment ?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ACJ,MAAI;AACF,eAAW,4BAAa,WAAW;AAAA,MACjC,MAAM;AAAA,MACN,KAAK,gBAAgB,gBAAgB;AAAA;AAAA,UAEvC;AAAA;AAEF,SAAO;AAAA;AATA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import path from "path";
|
|
4
|
+
import browserslist from "browserslist";
|
|
4
5
|
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
|
6
|
+
import { lazyPostCSS } from "next/dist/build/webpack/config/blocks/css";
|
|
7
|
+
import { getGlobalCssLoader } from "next/dist/build/webpack/config/blocks/css/loaders";
|
|
5
8
|
import webpack from "webpack";
|
|
6
9
|
const withTamagui = /* @__PURE__ */ __name((tamaguiOptions) => {
|
|
7
10
|
return (nextConfig = {}) => {
|
|
8
11
|
return Object.assign({}, nextConfig, {
|
|
9
12
|
webpack: (webpackConfig, options) => {
|
|
10
|
-
|
|
13
|
+
var _a;
|
|
14
|
+
const { dir, config, dev, isServer } = options;
|
|
15
|
+
const jsxRuntime = require.resolve("react/jsx-runtime.js");
|
|
16
|
+
const jsxDevRuntime = require.resolve("react/jsx-dev-runtime.js");
|
|
11
17
|
webpackConfig.resolve.alias = {
|
|
12
18
|
...webpackConfig.resolve.alias || {},
|
|
19
|
+
"react/jsx-runtime.js": jsxRuntime,
|
|
20
|
+
"react/jsx-runtime": jsxRuntime,
|
|
21
|
+
"react/jsx-dev-runtime.js": jsxDevRuntime,
|
|
22
|
+
"react/jsx-dev-runtime": jsxDevRuntime,
|
|
13
23
|
"react-native$": "react-native-web",
|
|
14
24
|
"react-native-web/src/modules/normalizeColor": require.resolve("react-native-web/dist/cjs/modules/normalizeColor"),
|
|
15
|
-
"react/jsx-runtime": require.resolve("react/jsx-runtime"),
|
|
16
|
-
"react/jsx-dev-runtime": require.resolve("react/jsx-dev-runtime"),
|
|
17
25
|
react: require.resolve("react"),
|
|
18
26
|
"react-dom": require.resolve("react-dom")
|
|
19
27
|
};
|
|
@@ -34,7 +42,7 @@ const withTamagui = /* @__PURE__ */ __name((tamaguiOptions) => {
|
|
|
34
42
|
webpackConfig.resolve.extensions = [".web.js", ...webpackConfig.resolve.extensions];
|
|
35
43
|
}
|
|
36
44
|
webpackConfig.resolve.mainFields.unshift("module:jsx");
|
|
37
|
-
const isWebpack5 = !!config.future.webpack5 || typeof config.webpack5 === "undefined";
|
|
45
|
+
const isWebpack5 = !!((_a = config.future) == null ? void 0 : _a.webpack5) || typeof config.webpack5 === "undefined";
|
|
38
46
|
const includeModule = /* @__PURE__ */ __name((context, request) => {
|
|
39
47
|
const fullPath = request[0] === "." ? path.join(context, request) : request;
|
|
40
48
|
if (/^\@?react-native-/.test(request)) {
|
|
@@ -83,40 +91,34 @@ const withTamagui = /* @__PURE__ */ __name((tamaguiOptions) => {
|
|
|
83
91
|
if (oneOfRule) {
|
|
84
92
|
if (!dev) {
|
|
85
93
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
86
|
-
oneOfRule.oneOf
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
];
|
|
94
|
+
oneOfRule.oneOf.unshift({
|
|
95
|
+
test: /\.css$/i,
|
|
96
|
+
use: [MiniCssExtractPlugin.loader, "css-loader"],
|
|
97
|
+
sideEffects: true
|
|
98
|
+
});
|
|
93
99
|
const idx = webpackConfig.plugins.findIndex((x) => x.constructor.name === "NextMiniCssExtractPlugin");
|
|
94
100
|
webpackConfig.plugins.splice(idx, 1, new MiniCssExtractPlugin({
|
|
95
101
|
filename: "static/css/[name].[contenthash].css",
|
|
96
102
|
ignoreOrder: true
|
|
97
103
|
}));
|
|
98
104
|
} else {
|
|
99
|
-
const {
|
|
100
|
-
getGlobalCssLoader
|
|
101
|
-
} = require("next/dist/build/webpack/config/blocks/css/loaders");
|
|
102
105
|
oneOfRule.oneOf.unshift({
|
|
103
106
|
test: /\.css$/i,
|
|
104
107
|
sideEffects: true,
|
|
105
108
|
use: getGlobalCssLoader({
|
|
106
|
-
assetPrefix: options.config.assetPrefix,
|
|
107
|
-
future:
|
|
109
|
+
assetPrefix: options.config.assetPrefix || config.assetPrefix,
|
|
110
|
+
future: nextConfig.future,
|
|
111
|
+
experimental: nextConfig.experimental || {},
|
|
108
112
|
isClient: !isServer,
|
|
109
113
|
isServer,
|
|
110
114
|
isDevelopment: true
|
|
111
|
-
},
|
|
115
|
+
}, () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)), [])
|
|
112
116
|
});
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
const shouldExclude = /* @__PURE__ */ __name((x) => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
return true;
|
|
120
|
+
const shouldInclude = x.includes(options.dir) || tamaguiOptions.components.some((c) => x.includes(`/node_modules/${c}`) || x.includes(`${c}/dist/jsx/`));
|
|
121
|
+
return !shouldInclude;
|
|
120
122
|
}, "shouldExclude");
|
|
121
123
|
const [first, second, ...rest] = webpackConfig.module.rules;
|
|
122
124
|
webpackConfig.module.rules = [
|
|
@@ -149,6 +151,18 @@ const withTamagui = /* @__PURE__ */ __name((tamaguiOptions) => {
|
|
|
149
151
|
});
|
|
150
152
|
};
|
|
151
153
|
}, "withTamagui");
|
|
154
|
+
function getSupportedBrowsers(dir, isDevelopment) {
|
|
155
|
+
let browsers;
|
|
156
|
+
try {
|
|
157
|
+
browsers = browserslist.loadConfig({
|
|
158
|
+
path: dir,
|
|
159
|
+
env: isDevelopment ? "development" : "production"
|
|
160
|
+
});
|
|
161
|
+
} catch {
|
|
162
|
+
}
|
|
163
|
+
return browsers;
|
|
164
|
+
}
|
|
165
|
+
__name(getSupportedBrowsers, "getSupportedBrowsers");
|
|
152
166
|
export {
|
|
153
167
|
withTamagui
|
|
154
168
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/withTamagui.ts"],
|
|
4
|
+
"sourcesContent": ["import path from 'path'\n\nimport { TamaguiOptions } from '@tamagui/static'\nimport browserslist from 'browserslist'\nimport CssMinimizerPlugin from 'css-minimizer-webpack-plugin'\nimport { lazyPostCSS } from 'next/dist/build/webpack/config/blocks/css'\nimport { getGlobalCssLoader } from 'next/dist/build/webpack/config/blocks/css/loaders'\nimport webpack from 'webpack'\n\nexport const withTamagui = (tamaguiOptions: TamaguiOptions) => {\n return (nextConfig: any = {}) => {\n return Object.assign({}, nextConfig, {\n webpack: (webpackConfig: any, options) => {\n const { dir, config, dev, isServer } = options\n\n // fixes https://github.com/kentcdodds/mdx-bundler/issues/143\n const jsxRuntime = require.resolve('react/jsx-runtime.js')\n const jsxDevRuntime = require.resolve('react/jsx-dev-runtime.js')\n\n webpackConfig.resolve.alias = {\n ...(webpackConfig.resolve.alias || {}),\n 'react/jsx-runtime.js': jsxRuntime,\n 'react/jsx-runtime': jsxRuntime,\n 'react/jsx-dev-runtime.js': jsxDevRuntime,\n 'react/jsx-dev-runtime': jsxDevRuntime,\n 'react-native$': 'react-native-web',\n 'react-native-web/src/modules/normalizeColor': require.resolve(\n 'react-native-web/dist/cjs/modules/normalizeColor'\n ),\n react: require.resolve('react'),\n 'react-dom': require.resolve('react-dom'),\n }\n\n webpackConfig.plugins.push(\n new webpack.DefinePlugin({\n 'process.env.TAMAGUI_TARGET': '\"web\"',\n })\n )\n\n if (process.env.IGNORE_TS_CONFIG_PATHS) {\n console.log('ignoring tsconfig paths, they mess up transpile')\n delete webpackConfig.resolve.plugins[0].paths['@tamagui/*']\n delete webpackConfig.resolve.plugins[0].paths['tamagui']\n }\n\n // TODO document and make configurable\n // replace minifier with css-minimizer-webpack-plugin which handles deduping atomic styles\n const cssMin = webpackConfig.optimization.minimizer.find((x) =>\n x.toString().includes('css-minimizer-plugin')\n )\n if (cssMin) {\n webpackConfig.optimization.minimizer = webpackConfig.optimization.minimizer.slice(\n cssMin.index,\n 1\n )\n }\n webpackConfig.optimization.minimizer.push(new CssMinimizerPlugin())\n\n if (!webpackConfig.resolve.extensions.includes('.web.js')) {\n webpackConfig.resolve.extensions = ['.web.js', ...webpackConfig.resolve.extensions]\n }\n\n // look for compiled js with jsx intact as specified by module:jsx\n webpackConfig.resolve.mainFields.unshift('module:jsx')\n\n const isWebpack5 = !!config.future?.webpack5 || typeof config.webpack5 === 'undefined'\n\n const includeModule = (context: string, request: string) => {\n const fullPath = request[0] === '.' ? path.join(context, request) : request\n if (/^\\@?react-native-/.test(request)) {\n return false\n }\n if (\n fullPath.startsWith('react-native-web') ||\n fullPath.includes('node_modules/react-native-web')\n ) {\n return `commonjs ${fullPath}`\n }\n if (/^(react-dom|react)$/.test(fullPath)) {\n return `commonjs ${fullPath}`\n }\n return true\n }\n\n if (isServer) {\n // externalize react native things from bundle\n webpackConfig.externals = [\n ...webpackConfig.externals.map((external) => {\n if (typeof external !== 'function') {\n return external\n }\n // only runs on server\n if (isWebpack5) {\n return (ctx, cb) => {\n const res = includeModule(ctx.context, ctx.request)\n if (typeof res === 'string') {\n return cb(null, res)\n }\n if (res) {\n return external(ctx, cb)\n }\n return cb()\n }\n }\n return (ctx, req, cb) => {\n const res = includeModule(ctx, req)\n if (typeof res === 'string') {\n return cb(null, res)\n }\n if (res) {\n return external(ctx, cb)\n }\n return cb()\n }\n }),\n ]\n }\n\n const oneOfRule = webpackConfig.module.rules.find((x) => !!x.oneOf)\n\n if (oneOfRule) {\n if (!dev) {\n // replace nextjs picky style rules with simple minicssextract\n const MiniCssExtractPlugin = require('mini-css-extract-plugin')\n oneOfRule.oneOf.unshift({\n test: /\\.css$/i,\n use: [MiniCssExtractPlugin.loader, 'css-loader'],\n sideEffects: true,\n })\n const idx = webpackConfig.plugins.findIndex(\n (x) => x.constructor.name === 'NextMiniCssExtractPlugin'\n )\n webpackConfig.plugins.splice(\n idx,\n 1,\n new MiniCssExtractPlugin({\n filename: 'static/css/[name].[contenthash].css',\n ignoreOrder: true,\n })\n )\n } else {\n oneOfRule.oneOf.unshift({\n test: /\\.css$/i,\n sideEffects: true,\n use: getGlobalCssLoader(\n // @ts-ignore\n {\n assetPrefix: options.config.assetPrefix || config.assetPrefix,\n future: nextConfig.future,\n experimental: nextConfig.experimental || {},\n isClient: !isServer,\n isServer,\n isDevelopment: true,\n },\n // @ts-ignore\n () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)),\n []\n ),\n })\n }\n }\n\n // add loader\n const shouldExclude = (x) => {\n // analyze everything in our src dir\n // analyze everything in the components dirs\n const shouldInclude =\n x.includes(options.dir) ||\n tamaguiOptions.components.some(\n (c) => x.includes(`/node_modules/${c}`) || x.includes(`${c}/dist/jsx/`)\n )\n\n return !shouldInclude\n }\n const [first, second, ...rest] = webpackConfig.module.rules\n webpackConfig.module.rules = [\n first,\n second,\n {\n test: /\\.(tsx|js|mjs|jsx)$/,\n exclude: shouldExclude,\n use: [\n {\n loader: 'esbuild-loader',\n options: {\n loader: 'tsx',\n minify: false,\n },\n },\n {\n loader: 'tamagui-loader',\n options: tamaguiOptions,\n },\n ],\n },\n ...rest,\n ]\n\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(webpackConfig, options)\n }\n\n return webpackConfig\n },\n })\n }\n}\n\nfunction getSupportedBrowsers(dir, isDevelopment) {\n let browsers\n try {\n browsers = browserslist.loadConfig({\n path: dir,\n env: isDevelopment ? 'development' : 'production',\n })\n } catch {}\n\n return browsers\n}\n"],
|
|
5
|
+
"mappings": ";;AAAA;AAGA;AACA;AACA;AACA;AACA;AAEO,MAAM,cAAc,wBAAC,mBAAmC;AAC7D,SAAO,CAAC,aAAkB,OAAO;AAC/B,WAAO,OAAO,OAAO,IAAI,YAAY;AAAA,MACnC,SAAS,CAAC,eAAoB,YAAY;AAZhD;AAaQ,cAAM,EAAE,KAAK,QAAQ,KAAK,aAAa;AAGvC,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BACX;AAAA,gBACA,eAAe;AAAA,iBAGjB,MAAM,YAAY,KAAK,qBAAqB,KAAK,OACjD;AAAA;AAAA;AAAA;AAOR,cAAM,gBAAgB,wBAAC,MAAM;AAG3B,gBAAM,gBACJ,EAAE,SAAS,QAAQ,QACnB,eAAe,WAAW,KACxB,CAAC,MAAM,EAAE,SAAS,iBAAiB,QAAQ,EAAE,SAAS,GAAG;AAG7D,iBAAO,CAAC;AAAA,WATY;AAWtB,cAAM,CAAC,OAAO,WAAW,QAAQ,cAAc,OAAO;AACtD,sBAAc,OAAO,QAAQ;AAAA,UAC3B;AAAA,UACA;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,SAAS;AAAA,YACT,KAAK;AAAA,cACH;AAAA,gBACE,QAAQ;AAAA,gBACR,SAAS;AAAA,kBACP,QAAQ;AAAA,kBACR,QAAQ;AAAA;AAAA;AAAA,cAGZ;AAAA,gBACE,QAAQ;AAAA,gBACR,SAAS;AAAA;AAAA;AAAA;AAAA,UAIf,GAAG;AAAA;AAGL,YAAI,OAAO,WAAW,YAAY,YAAY;AAC5C,iBAAO,WAAW,QAAQ,eAAe;AAAA;AAG3C,eAAO;AAAA;AAAA;AAAA;AAAA,GAjMY;AAuM3B,8BAA8B,KAAK,eAAe;AAChD,MAAI;AACJ,MAAI;AACF,eAAW,aAAa,WAAW;AAAA,MACjC,MAAM;AAAA,MACN,KAAK,gBAAgB,gBAAgB;AAAA;AAAA,UAEvC;AAAA;AAEF,SAAO;AAAA;AATA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./withTamagui";
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import path from "path";
|
|
4
|
+
import browserslist from "browserslist";
|
|
5
|
+
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
|
6
|
+
import { lazyPostCSS } from "next/dist/build/webpack/config/blocks/css";
|
|
7
|
+
import { getGlobalCssLoader } from "next/dist/build/webpack/config/blocks/css/loaders";
|
|
8
|
+
import webpack from "webpack";
|
|
9
|
+
const withTamagui = /* @__PURE__ */ __name((tamaguiOptions) => {
|
|
10
|
+
return (nextConfig = {}) => {
|
|
11
|
+
return Object.assign({}, nextConfig, {
|
|
12
|
+
webpack: (webpackConfig, options) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const { dir, config, dev, isServer } = options;
|
|
15
|
+
const jsxRuntime = require.resolve("react/jsx-runtime.js");
|
|
16
|
+
const jsxDevRuntime = require.resolve("react/jsx-dev-runtime.js");
|
|
17
|
+
webpackConfig.resolve.alias = {
|
|
18
|
+
...webpackConfig.resolve.alias || {},
|
|
19
|
+
"react/jsx-runtime.js": jsxRuntime,
|
|
20
|
+
"react/jsx-runtime": jsxRuntime,
|
|
21
|
+
"react/jsx-dev-runtime.js": jsxDevRuntime,
|
|
22
|
+
"react/jsx-dev-runtime": jsxDevRuntime,
|
|
23
|
+
"react-native$": "react-native-web",
|
|
24
|
+
"react-native-web/src/modules/normalizeColor": require.resolve("react-native-web/dist/cjs/modules/normalizeColor"),
|
|
25
|
+
react: require.resolve("react"),
|
|
26
|
+
"react-dom": require.resolve("react-dom")
|
|
27
|
+
};
|
|
28
|
+
webpackConfig.plugins.push(new webpack.DefinePlugin({
|
|
29
|
+
"process.env.TAMAGUI_TARGET": '"web"'
|
|
30
|
+
}));
|
|
31
|
+
if (process.env.IGNORE_TS_CONFIG_PATHS) {
|
|
32
|
+
console.log("ignoring tsconfig paths, they mess up transpile");
|
|
33
|
+
delete webpackConfig.resolve.plugins[0].paths["@tamagui/*"];
|
|
34
|
+
delete webpackConfig.resolve.plugins[0].paths["tamagui"];
|
|
35
|
+
}
|
|
36
|
+
const cssMin = webpackConfig.optimization.minimizer.find((x) => x.toString().includes("css-minimizer-plugin"));
|
|
37
|
+
if (cssMin) {
|
|
38
|
+
webpackConfig.optimization.minimizer = webpackConfig.optimization.minimizer.slice(cssMin.index, 1);
|
|
39
|
+
}
|
|
40
|
+
webpackConfig.optimization.minimizer.push(new CssMinimizerPlugin());
|
|
41
|
+
if (!webpackConfig.resolve.extensions.includes(".web.js")) {
|
|
42
|
+
webpackConfig.resolve.extensions = [".web.js", ...webpackConfig.resolve.extensions];
|
|
43
|
+
}
|
|
44
|
+
webpackConfig.resolve.mainFields.unshift("module:jsx");
|
|
45
|
+
const isWebpack5 = !!((_a = config.future) == null ? void 0 : _a.webpack5) || typeof config.webpack5 === "undefined";
|
|
46
|
+
const includeModule = /* @__PURE__ */ __name((context, request) => {
|
|
47
|
+
const fullPath = request[0] === "." ? path.join(context, request) : request;
|
|
48
|
+
if (/^\@?react-native-/.test(request)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (fullPath.startsWith("react-native-web") || fullPath.includes("node_modules/react-native-web")) {
|
|
52
|
+
return `commonjs ${fullPath}`;
|
|
53
|
+
}
|
|
54
|
+
if (/^(react-dom|react)$/.test(fullPath)) {
|
|
55
|
+
return `commonjs ${fullPath}`;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}, "includeModule");
|
|
59
|
+
if (isServer) {
|
|
60
|
+
webpackConfig.externals = [
|
|
61
|
+
...webpackConfig.externals.map((external) => {
|
|
62
|
+
if (typeof external !== "function") {
|
|
63
|
+
return external;
|
|
64
|
+
}
|
|
65
|
+
if (isWebpack5) {
|
|
66
|
+
return (ctx, cb) => {
|
|
67
|
+
const res = includeModule(ctx.context, ctx.request);
|
|
68
|
+
if (typeof res === "string") {
|
|
69
|
+
return cb(null, res);
|
|
70
|
+
}
|
|
71
|
+
if (res) {
|
|
72
|
+
return external(ctx, cb);
|
|
73
|
+
}
|
|
74
|
+
return cb();
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return (ctx, req, cb) => {
|
|
78
|
+
const res = includeModule(ctx, req);
|
|
79
|
+
if (typeof res === "string") {
|
|
80
|
+
return cb(null, res);
|
|
81
|
+
}
|
|
82
|
+
if (res) {
|
|
83
|
+
return external(ctx, cb);
|
|
84
|
+
}
|
|
85
|
+
return cb();
|
|
86
|
+
};
|
|
87
|
+
})
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
const oneOfRule = webpackConfig.module.rules.find((x) => !!x.oneOf);
|
|
91
|
+
if (oneOfRule) {
|
|
92
|
+
if (!dev) {
|
|
93
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
94
|
+
oneOfRule.oneOf.unshift({
|
|
95
|
+
test: /\.css$/i,
|
|
96
|
+
use: [MiniCssExtractPlugin.loader, "css-loader"],
|
|
97
|
+
sideEffects: true
|
|
98
|
+
});
|
|
99
|
+
const idx = webpackConfig.plugins.findIndex((x) => x.constructor.name === "NextMiniCssExtractPlugin");
|
|
100
|
+
webpackConfig.plugins.splice(idx, 1, new MiniCssExtractPlugin({
|
|
101
|
+
filename: "static/css/[name].[contenthash].css",
|
|
102
|
+
ignoreOrder: true
|
|
103
|
+
}));
|
|
104
|
+
} else {
|
|
105
|
+
oneOfRule.oneOf.unshift({
|
|
106
|
+
test: /\.css$/i,
|
|
107
|
+
sideEffects: true,
|
|
108
|
+
use: getGlobalCssLoader({
|
|
109
|
+
assetPrefix: options.config.assetPrefix || config.assetPrefix,
|
|
110
|
+
future: nextConfig.future,
|
|
111
|
+
experimental: nextConfig.experimental || {},
|
|
112
|
+
isClient: !isServer,
|
|
113
|
+
isServer,
|
|
114
|
+
isDevelopment: true
|
|
115
|
+
}, () => lazyPostCSS(dir, getSupportedBrowsers(dir, dev)), [])
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const shouldExclude = /* @__PURE__ */ __name((x) => {
|
|
120
|
+
const shouldInclude = x.includes(options.dir) || tamaguiOptions.components.some((c) => x.includes(`/node_modules/${c}`) || x.includes(`${c}/dist/jsx/`));
|
|
121
|
+
return !shouldInclude;
|
|
122
|
+
}, "shouldExclude");
|
|
123
|
+
const [first, second, ...rest] = webpackConfig.module.rules;
|
|
124
|
+
webpackConfig.module.rules = [
|
|
125
|
+
first,
|
|
126
|
+
second,
|
|
127
|
+
{
|
|
128
|
+
test: /\.(tsx|js|mjs|jsx)$/,
|
|
129
|
+
exclude: shouldExclude,
|
|
130
|
+
use: [
|
|
131
|
+
{
|
|
132
|
+
loader: "esbuild-loader",
|
|
133
|
+
options: {
|
|
134
|
+
loader: "tsx",
|
|
135
|
+
minify: false
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
loader: "tamagui-loader",
|
|
140
|
+
options: tamaguiOptions
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
...rest
|
|
145
|
+
];
|
|
146
|
+
if (typeof nextConfig.webpack === "function") {
|
|
147
|
+
return nextConfig.webpack(webpackConfig, options);
|
|
148
|
+
}
|
|
149
|
+
return webpackConfig;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
}, "withTamagui");
|
|
154
|
+
function getSupportedBrowsers(dir, isDevelopment) {
|
|
155
|
+
let browsers;
|
|
156
|
+
try {
|
|
157
|
+
browsers = browserslist.loadConfig({
|
|
158
|
+
path: dir,
|
|
159
|
+
env: isDevelopment ? "development" : "production"
|
|
160
|
+
});
|
|
161
|
+
} catch {
|
|
162
|
+
}
|
|
163
|
+
return browsers;
|
|
164
|
+
}
|
|
165
|
+
__name(getSupportedBrowsers, "getSupportedBrowsers");
|
|
166
|
+
export {
|
|
167
|
+
withTamagui
|
|
168
|
+
};
|
package/package.json
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/next-plugin",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.43",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"typings": "types",
|
|
7
|
+
"main": "dist/cjs",
|
|
8
|
+
"module": "dist/esm",
|
|
9
|
+
"module:jsx": "dist/jsx",
|
|
8
10
|
"files": [
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
+
"types",
|
|
12
|
+
"dist"
|
|
11
13
|
],
|
|
12
14
|
"scripts": {
|
|
13
15
|
"build": "tamagui-build",
|
|
14
16
|
"watch": "tamagui-build --watch"
|
|
15
17
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"@tamagui/static": "^1.0.0-alpha.4",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@tamagui/static": "^1.0.0-alpha.43",
|
|
20
|
+
"browserslist": "^4.19.1",
|
|
20
21
|
"css-minimizer-webpack-plugin": "^3.1.3",
|
|
21
22
|
"esbuild-loader": "^2.16.0",
|
|
22
23
|
"next-compose-plugins": "^2.2.1",
|
|
23
|
-
"tamagui-loader": "^1.0.0-alpha.
|
|
24
|
+
"tamagui-loader": "^1.0.0-alpha.43"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@tamagui/build": "^1.0.0-alpha.43",
|
|
28
|
+
"next": "^12.0.8"
|
|
24
29
|
},
|
|
25
30
|
"peerDependencies": {
|
|
26
31
|
"next": ">=11.0.0"
|
|
@@ -28,5 +33,5 @@
|
|
|
28
33
|
"publishConfig": {
|
|
29
34
|
"access": "public"
|
|
30
35
|
},
|
|
31
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "9e1ffc33567f7a5a9c4850f15ab8a082d81ed5f1"
|
|
32
37
|
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withTamagui.d.ts","sourceRoot":"","sources":["../src/withTamagui.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAOhD,eAAO,MAAM,WAAW,mBAAoB,cAAc,mBACpC,GAAG,QAoMxB,CAAA"}
|
package/dist/index.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts", "../src/withTamagui.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './withTamagui'\n", "import path from 'path'\n\nimport { TamaguiOptions } from '@tamagui/static'\nimport CssMinimizerPlugin from 'css-minimizer-webpack-plugin'\nimport webpack from 'webpack'\n\nexport const withTamagui = (tamaguiOptions: TamaguiOptions) => {\n return (nextConfig: any = {}) => {\n return Object.assign({}, nextConfig, {\n webpack: (webpackConfig, options) => {\n const { config, dev, isServer } = options\n\n webpackConfig.resolve.alias = {\n ...(webpackConfig.resolve.alias || {}),\n 'react-native$': 'react-native-web',\n 'react-native-web/src/modules/normalizeColor': require.resolve(\n 'react-native-web/dist/cjs/modules/normalizeColor'\n ),\n // fix mdx-bundler issue importing .js specifically\n // 'react/jsx-runtime.js': require.resolve('react/jsx-runtime'),\n 'react/jsx-runtime': require.resolve('react/jsx-runtime'),\n 'react/jsx-dev-runtime': require.resolve('react/jsx-dev-runtime'),\n react: require.resolve('react'),\n 'react-dom': require.resolve('react-dom'),\n }\n\n webpackConfig.plugins.push(\n new webpack.DefinePlugin({\n 'process.env.TAMAGUI_TARGET': '\"web\"',\n })\n )\n\n if (process.env.IGNORE_TS_CONFIG_PATHS) {\n console.log('ignoring tsconfig paths, they mess up transpile')\n delete webpackConfig.resolve.plugins[0].paths['@tamagui/*']\n delete webpackConfig.resolve.plugins[0].paths['tamagui']\n }\n\n // TODO document and make configurable\n // replace minifier with css-minimizer-webpack-plugin which handles deduping atomic styles\n const cssMin = webpackConfig.optimization.minimizer.find((x) =>\n x.toString().includes('css-minimizer-plugin')\n )\n if (cssMin) {\n webpackConfig.optimization.minimizer = webpackConfig.optimization.minimizer.slice(\n cssMin.index,\n 1\n )\n }\n webpackConfig.optimization.minimizer.push(new CssMinimizerPlugin())\n\n if (!webpackConfig.resolve.extensions.includes('.web.js')) {\n webpackConfig.resolve.extensions = ['.web.js', ...webpackConfig.resolve.extensions]\n }\n\n // look for compiled js with jsx intact as specified by module:jsx\n webpackConfig.resolve.mainFields.unshift('module:jsx')\n\n // why is it undefined on next11??? but it says using webpack5\n const isWebpack5 = !!config.future.webpack5 || typeof config.webpack5 === 'undefined'\n\n const includeModule = (context: string, request: string) => {\n const fullPath = request[0] === '.' ? path.join(context, request) : request\n if (/^\\@?react-native-/.test(request)) {\n return false\n }\n if (\n fullPath.startsWith('react-native-web') ||\n fullPath.includes('node_modules/react-native-web')\n ) {\n return `commonjs ${fullPath}`\n }\n if (/^(react-dom|react)$/.test(fullPath)) {\n return `commonjs ${fullPath}`\n }\n return true\n }\n\n if (isServer) {\n // externalize react native things from bundle\n webpackConfig.externals = [\n ...webpackConfig.externals.map((external) => {\n if (typeof external !== 'function') {\n return external\n }\n // only runs on server\n if (isWebpack5) {\n return (ctx, cb) => {\n const res = includeModule(ctx.context, ctx.request)\n if (typeof res === 'string') {\n return cb(null, res)\n }\n if (res) {\n return external(ctx, cb)\n }\n return cb()\n }\n }\n return (ctx, req, cb) => {\n const res = includeModule(ctx, req)\n if (typeof res === 'string') {\n return cb(null, res)\n }\n if (res) {\n return external(ctx, cb)\n }\n return cb()\n }\n }),\n ]\n }\n\n const oneOfRule = webpackConfig.module.rules.find((x) => !!x.oneOf)\n\n if (oneOfRule) {\n if (!dev) {\n // replace nextjs picky style rules with simple minicssextract\n const MiniCssExtractPlugin = require('mini-css-extract-plugin')\n oneOfRule.oneOf = [\n {\n test: /\\.css$/i,\n use: [MiniCssExtractPlugin.loader, 'css-loader'],\n sideEffects: true,\n },\n ]\n const idx = webpackConfig.plugins.findIndex(\n (x) => x.constructor.name === 'NextMiniCssExtractPlugin'\n )\n webpackConfig.plugins.splice(\n idx,\n 1,\n new MiniCssExtractPlugin({\n filename: 'static/css/[name].[contenthash].css',\n ignoreOrder: true,\n })\n )\n } else {\n const {\n getGlobalCssLoader,\n } = require('next/dist/build/webpack/config/blocks/css/loaders')\n oneOfRule.oneOf.unshift({\n test: /\\.css$/i,\n sideEffects: true,\n use: getGlobalCssLoader(\n {\n assetPrefix: options.config.assetPrefix,\n future: { webpack5: true },\n isClient: !isServer,\n isServer,\n isDevelopment: true,\n },\n [],\n []\n ),\n })\n }\n }\n\n // add loader\n const shouldExclude = (x) => {\n // analyze everything in our src dir\n // analyze everything in the components dirs\n if (\n x.includes(options.dir) ||\n tamaguiOptions.components.some(\n (c) => x.includes(`/node_modules/${c}`) || x.includes(`${c}/_jsx/`)\n )\n ) {\n return false\n }\n // exclude everything else\n return true\n }\n const [first, second, ...rest] = webpackConfig.module.rules\n webpackConfig.module.rules = [\n first,\n second,\n {\n test: /\\.(tsx|js|mjs|jsx)$/,\n exclude: shouldExclude,\n use: [\n {\n loader: 'esbuild-loader',\n options: {\n loader: 'tsx',\n minify: false,\n },\n },\n {\n loader: 'tamagui-loader',\n options: tamaguiOptions,\n },\n ],\n },\n ...rest,\n ]\n\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(webpackConfig, options)\n }\n\n return webpackConfig\n },\n })\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;;;ACAA,kBAAiB;AAGjB,0CAA+B;AAC/B,qBAAoB;AAEb,IAAM,cAAc,wBAAC,mBAAmC;AAC7D,SAAO,CAAC,aAAkB,OAAO;AAC/B,WAAO,OAAO,OAAO,IAAI,YAAY;AAAA,MACnC,SAAS,CAAC,eAAe,YAAY;AACnC,cAAM,EAAE,QAAQ,KAAK,aAAa;AAElC,sBAAc,QAAQ,QAAQ,iCACxB,cAAc,QAAQ,SAAS,KADP;AAAA,UAE5B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eAAe,WAAW,KACxB,CAAC,MAAM,EAAE,SAAS,iBAAiB,QAAQ,EAAE,SAAS,GAAG,aAE3D;AACA,mBAAO;AAAA;AAGT,iBAAO;AAAA,WAZa;AActB,cAAM,CAAC,OAAO,WAAW,QAAQ,cAAc,OAAO;AACtD,sBAAc,OAAO,QAAQ;AAAA,UAC3B;AAAA,UACA;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,SAAS;AAAA,YACT,KAAK;AAAA,cACH;AAAA,gBACE,QAAQ;AAAA,gBACR,SAAS;AAAA,kBACP,QAAQ;AAAA,kBACR,QAAQ;AAAA;AAAA;AAAA,cAGZ;AAAA,gBACE,QAAQ;AAAA,gBACR,SAAS;AAAA;AAAA;AAAA;AAAA,UAIf,GAAG;AAAA;AAGL,YAAI,OAAO,WAAW,YAAY,YAAY;AAC5C,iBAAO,WAAW,QAAQ,eAAe;AAAA;AAG3C,eAAO;AAAA;AAAA;AAAA;AAAA,GAnMY;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/withTamagui.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/withTamagui.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path'\n\nimport { TamaguiOptions } from '@tamagui/static'\nimport CssMinimizerPlugin from 'css-minimizer-webpack-plugin'\nimport webpack from 'webpack'\n\nexport const withTamagui = (tamaguiOptions: TamaguiOptions) => {\n return (nextConfig: any = {}) => {\n return Object.assign({}, nextConfig, {\n webpack: (webpackConfig, options) => {\n const { config, dev, isServer } = options\n\n webpackConfig.resolve.alias = {\n ...(webpackConfig.resolve.alias || {}),\n 'react-native$': 'react-native-web',\n 'react-native-web/src/modules/normalizeColor': require.resolve(\n 'react-native-web/dist/cjs/modules/normalizeColor'\n ),\n // fix mdx-bundler issue importing .js specifically\n // 'react/jsx-runtime.js': require.resolve('react/jsx-runtime'),\n 'react/jsx-runtime': require.resolve('react/jsx-runtime'),\n 'react/jsx-dev-runtime': require.resolve('react/jsx-dev-runtime'),\n react: require.resolve('react'),\n 'react-dom': require.resolve('react-dom'),\n }\n\n webpackConfig.plugins.push(\n new webpack.DefinePlugin({\n 'process.env.TAMAGUI_TARGET': '\"web\"',\n })\n )\n\n if (process.env.IGNORE_TS_CONFIG_PATHS) {\n console.log('ignoring tsconfig paths, they mess up transpile')\n delete webpackConfig.resolve.plugins[0].paths['@tamagui/*']\n delete webpackConfig.resolve.plugins[0].paths['tamagui']\n }\n\n // TODO document and make configurable\n // replace minifier with css-minimizer-webpack-plugin which handles deduping atomic styles\n const cssMin = webpackConfig.optimization.minimizer.find((x) =>\n x.toString().includes('css-minimizer-plugin')\n )\n if (cssMin) {\n webpackConfig.optimization.minimizer = webpackConfig.optimization.minimizer.slice(\n cssMin.index,\n 1\n )\n }\n webpackConfig.optimization.minimizer.push(new CssMinimizerPlugin())\n\n if (!webpackConfig.resolve.extensions.includes('.web.js')) {\n webpackConfig.resolve.extensions = ['.web.js', ...webpackConfig.resolve.extensions]\n }\n\n // look for compiled js with jsx intact as specified by module:jsx\n webpackConfig.resolve.mainFields.unshift('module:jsx')\n\n // why is it undefined on next11??? but it says using webpack5\n const isWebpack5 = !!config.future.webpack5 || typeof config.webpack5 === 'undefined'\n\n const includeModule = (context: string, request: string) => {\n const fullPath = request[0] === '.' ? path.join(context, request) : request\n if (/^\\@?react-native-/.test(request)) {\n return false\n }\n if (\n fullPath.startsWith('react-native-web') ||\n fullPath.includes('node_modules/react-native-web')\n ) {\n return `commonjs ${fullPath}`\n }\n if (/^(react-dom|react)$/.test(fullPath)) {\n return `commonjs ${fullPath}`\n }\n return true\n }\n\n if (isServer) {\n // externalize react native things from bundle\n webpackConfig.externals = [\n ...webpackConfig.externals.map((external) => {\n if (typeof external !== 'function') {\n return external\n }\n // only runs on server\n if (isWebpack5) {\n return (ctx, cb) => {\n const res = includeModule(ctx.context, ctx.request)\n if (typeof res === 'string') {\n return cb(null, res)\n }\n if (res) {\n return external(ctx, cb)\n }\n return cb()\n }\n }\n return (ctx, req, cb) => {\n const res = includeModule(ctx, req)\n if (typeof res === 'string') {\n return cb(null, res)\n }\n if (res) {\n return external(ctx, cb)\n }\n return cb()\n }\n }),\n ]\n }\n\n const oneOfRule = webpackConfig.module.rules.find((x) => !!x.oneOf)\n\n if (oneOfRule) {\n if (!dev) {\n // replace nextjs picky style rules with simple minicssextract\n const MiniCssExtractPlugin = require('mini-css-extract-plugin')\n oneOfRule.oneOf = [\n {\n test: /\\.css$/i,\n use: [MiniCssExtractPlugin.loader, 'css-loader'],\n sideEffects: true,\n },\n ]\n const idx = webpackConfig.plugins.findIndex(\n (x) => x.constructor.name === 'NextMiniCssExtractPlugin'\n )\n webpackConfig.plugins.splice(\n idx,\n 1,\n new MiniCssExtractPlugin({\n filename: 'static/css/[name].[contenthash].css',\n ignoreOrder: true,\n })\n )\n } else {\n const {\n getGlobalCssLoader,\n } = require('next/dist/build/webpack/config/blocks/css/loaders')\n oneOfRule.oneOf.unshift({\n test: /\\.css$/i,\n sideEffects: true,\n use: getGlobalCssLoader(\n {\n assetPrefix: options.config.assetPrefix,\n future: { webpack5: true },\n isClient: !isServer,\n isServer,\n isDevelopment: true,\n },\n [],\n []\n ),\n })\n }\n }\n\n // add loader\n const shouldExclude = (x) => {\n // analyze everything in our src dir\n // analyze everything in the components dirs\n if (\n x.includes(options.dir) ||\n tamaguiOptions.components.some(\n (c) => x.includes(`/node_modules/${c}`) || x.includes(`${c}/_jsx/`)\n )\n ) {\n return false\n }\n // exclude everything else\n return true\n }\n const [first, second, ...rest] = webpackConfig.module.rules\n webpackConfig.module.rules = [\n first,\n second,\n {\n test: /\\.(tsx|js|mjs|jsx)$/,\n exclude: shouldExclude,\n use: [\n {\n loader: 'esbuild-loader',\n options: {\n loader: 'tsx',\n minify: false,\n },\n },\n {\n loader: 'tamagui-loader',\n options: tamaguiOptions,\n },\n ],\n },\n ...rest,\n ]\n\n if (typeof nextConfig.webpack === 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kBAAM;AAAA,cACJ;AAAA,gBACE,QAAQ;AACZ,sBAAU,MAAM,QAAQ;AAAA,cACtB,MAAM;AAAA,cACN,aAAa;AAAA,cACb,KAAK,mBACH;AAAA,gBACE,aAAa,QAAQ,OAAO;AAAA,gBAC5B,QAAQ,EAAE,UAAU;AAAA,gBACpB,UAAU,CAAC;AAAA,gBACX;AAAA,gBACA,eAAe;AAAA,iBAEjB,IACA;AAAA;AAAA;AAAA;AAOR,cAAM,gBAAgB,wBAAC,MAAM;AAG3B,cACE,EAAE,SAAS,QAAQ,QACnB,eAAe,WAAW,KACxB,CAAC,MAAM,EAAE,SAAS,iBAAiB,QAAQ,EAAE,SAAS,GAAG,aAE3D;AACA,mBAAO;AAAA;AAGT,iBAAO;AAAA,WAZa;AActB,cAAM,CAAC,OAAO,WAAW,QAAQ,cAAc,OAAO;AACtD,sBAAc,OAAO,QAAQ;AAAA,UAC3B;AAAA,UACA;AAAA,UACA;AAAA,YACE,MAAM;AAAA,YACN,SAAS;AAAA,YACT,KAAK;AAAA,cACH;AAAA,gBACE,QAAQ;AAAA,gBACR,SAAS;AAAA,kBACP,QAAQ;AAAA,kBACR,QAAQ;AAAA;AAAA;AAAA,cAGZ;AAAA,gBACE,QAAQ;AAAA,gBACR,SAAS;AAAA;AAAA;AAAA;AAAA,UAIf,GAAG;AAAA;AAGL,YAAI,OAAO,WAAW,YAAY,YAAY;AAC5C,iBAAO,WAAW,QAAQ,eAAe;AAAA;AAG3C,eAAO;AAAA;AAAA;AAAA;AAAA,GAnMY;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './withTamagui'
|
package/src/withTamagui.ts
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
|
|
3
|
-
import { TamaguiOptions } from '@tamagui/static'
|
|
4
|
-
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin'
|
|
5
|
-
import webpack from 'webpack'
|
|
6
|
-
|
|
7
|
-
export const withTamagui = (tamaguiOptions: TamaguiOptions) => {
|
|
8
|
-
return (nextConfig: any = {}) => {
|
|
9
|
-
return Object.assign({}, nextConfig, {
|
|
10
|
-
webpack: (webpackConfig, options) => {
|
|
11
|
-
const { config, dev, isServer } = options
|
|
12
|
-
|
|
13
|
-
webpackConfig.resolve.alias = {
|
|
14
|
-
...(webpackConfig.resolve.alias || {}),
|
|
15
|
-
'react-native$': 'react-native-web',
|
|
16
|
-
'react-native-web/src/modules/normalizeColor': require.resolve(
|
|
17
|
-
'react-native-web/dist/cjs/modules/normalizeColor'
|
|
18
|
-
),
|
|
19
|
-
// fix mdx-bundler issue importing .js specifically
|
|
20
|
-
// 'react/jsx-runtime.js': require.resolve('react/jsx-runtime'),
|
|
21
|
-
'react/jsx-runtime': require.resolve('react/jsx-runtime'),
|
|
22
|
-
'react/jsx-dev-runtime': require.resolve('react/jsx-dev-runtime'),
|
|
23
|
-
react: require.resolve('react'),
|
|
24
|
-
'react-dom': require.resolve('react-dom'),
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
webpackConfig.plugins.push(
|
|
28
|
-
new webpack.DefinePlugin({
|
|
29
|
-
'process.env.TAMAGUI_TARGET': '"web"',
|
|
30
|
-
})
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
if (process.env.IGNORE_TS_CONFIG_PATHS) {
|
|
34
|
-
console.log('ignoring tsconfig paths, they mess up transpile')
|
|
35
|
-
delete webpackConfig.resolve.plugins[0].paths['@tamagui/*']
|
|
36
|
-
delete webpackConfig.resolve.plugins[0].paths['tamagui']
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// TODO document and make configurable
|
|
40
|
-
// replace minifier with css-minimizer-webpack-plugin which handles deduping atomic styles
|
|
41
|
-
const cssMin = webpackConfig.optimization.minimizer.find((x) =>
|
|
42
|
-
x.toString().includes('css-minimizer-plugin')
|
|
43
|
-
)
|
|
44
|
-
if (cssMin) {
|
|
45
|
-
webpackConfig.optimization.minimizer = webpackConfig.optimization.minimizer.slice(
|
|
46
|
-
cssMin.index,
|
|
47
|
-
1
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
webpackConfig.optimization.minimizer.push(new CssMinimizerPlugin())
|
|
51
|
-
|
|
52
|
-
if (!webpackConfig.resolve.extensions.includes('.web.js')) {
|
|
53
|
-
webpackConfig.resolve.extensions = ['.web.js', ...webpackConfig.resolve.extensions]
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// look for compiled js with jsx intact as specified by module:jsx
|
|
57
|
-
webpackConfig.resolve.mainFields.unshift('module:jsx')
|
|
58
|
-
|
|
59
|
-
// why is it undefined on next11??? but it says using webpack5
|
|
60
|
-
const isWebpack5 = !!config.future.webpack5 || typeof config.webpack5 === 'undefined'
|
|
61
|
-
|
|
62
|
-
const includeModule = (context: string, request: string) => {
|
|
63
|
-
const fullPath = request[0] === '.' ? path.join(context, request) : request
|
|
64
|
-
if (/^\@?react-native-/.test(request)) {
|
|
65
|
-
return false
|
|
66
|
-
}
|
|
67
|
-
if (
|
|
68
|
-
fullPath.startsWith('react-native-web') ||
|
|
69
|
-
fullPath.includes('node_modules/react-native-web')
|
|
70
|
-
) {
|
|
71
|
-
return `commonjs ${fullPath}`
|
|
72
|
-
}
|
|
73
|
-
if (/^(react-dom|react)$/.test(fullPath)) {
|
|
74
|
-
return `commonjs ${fullPath}`
|
|
75
|
-
}
|
|
76
|
-
return true
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (isServer) {
|
|
80
|
-
// externalize react native things from bundle
|
|
81
|
-
webpackConfig.externals = [
|
|
82
|
-
...webpackConfig.externals.map((external) => {
|
|
83
|
-
if (typeof external !== 'function') {
|
|
84
|
-
return external
|
|
85
|
-
}
|
|
86
|
-
// only runs on server
|
|
87
|
-
if (isWebpack5) {
|
|
88
|
-
return (ctx, cb) => {
|
|
89
|
-
const res = includeModule(ctx.context, ctx.request)
|
|
90
|
-
if (typeof res === 'string') {
|
|
91
|
-
return cb(null, res)
|
|
92
|
-
}
|
|
93
|
-
if (res) {
|
|
94
|
-
return external(ctx, cb)
|
|
95
|
-
}
|
|
96
|
-
return cb()
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return (ctx, req, cb) => {
|
|
100
|
-
const res = includeModule(ctx, req)
|
|
101
|
-
if (typeof res === 'string') {
|
|
102
|
-
return cb(null, res)
|
|
103
|
-
}
|
|
104
|
-
if (res) {
|
|
105
|
-
return external(ctx, cb)
|
|
106
|
-
}
|
|
107
|
-
return cb()
|
|
108
|
-
}
|
|
109
|
-
}),
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const oneOfRule = webpackConfig.module.rules.find((x) => !!x.oneOf)
|
|
114
|
-
|
|
115
|
-
if (oneOfRule) {
|
|
116
|
-
if (!dev) {
|
|
117
|
-
// replace nextjs picky style rules with simple minicssextract
|
|
118
|
-
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
119
|
-
oneOfRule.oneOf = [
|
|
120
|
-
{
|
|
121
|
-
test: /\.css$/i,
|
|
122
|
-
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
|
123
|
-
sideEffects: true,
|
|
124
|
-
},
|
|
125
|
-
]
|
|
126
|
-
const idx = webpackConfig.plugins.findIndex(
|
|
127
|
-
(x) => x.constructor.name === 'NextMiniCssExtractPlugin'
|
|
128
|
-
)
|
|
129
|
-
webpackConfig.plugins.splice(
|
|
130
|
-
idx,
|
|
131
|
-
1,
|
|
132
|
-
new MiniCssExtractPlugin({
|
|
133
|
-
filename: 'static/css/[name].[contenthash].css',
|
|
134
|
-
ignoreOrder: true,
|
|
135
|
-
})
|
|
136
|
-
)
|
|
137
|
-
} else {
|
|
138
|
-
const {
|
|
139
|
-
getGlobalCssLoader,
|
|
140
|
-
} = require('next/dist/build/webpack/config/blocks/css/loaders')
|
|
141
|
-
oneOfRule.oneOf.unshift({
|
|
142
|
-
test: /\.css$/i,
|
|
143
|
-
sideEffects: true,
|
|
144
|
-
use: getGlobalCssLoader(
|
|
145
|
-
{
|
|
146
|
-
assetPrefix: options.config.assetPrefix,
|
|
147
|
-
future: { webpack5: true },
|
|
148
|
-
isClient: !isServer,
|
|
149
|
-
isServer,
|
|
150
|
-
isDevelopment: true,
|
|
151
|
-
},
|
|
152
|
-
[],
|
|
153
|
-
[]
|
|
154
|
-
),
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// add loader
|
|
160
|
-
const shouldExclude = (x) => {
|
|
161
|
-
// analyze everything in our src dir
|
|
162
|
-
// analyze everything in the components dirs
|
|
163
|
-
if (
|
|
164
|
-
x.includes(options.dir) ||
|
|
165
|
-
tamaguiOptions.components.some(
|
|
166
|
-
(c) => x.includes(`/node_modules/${c}`) || x.includes(`${c}/_jsx/`)
|
|
167
|
-
)
|
|
168
|
-
) {
|
|
169
|
-
return false
|
|
170
|
-
}
|
|
171
|
-
// exclude everything else
|
|
172
|
-
return true
|
|
173
|
-
}
|
|
174
|
-
const [first, second, ...rest] = webpackConfig.module.rules
|
|
175
|
-
webpackConfig.module.rules = [
|
|
176
|
-
first,
|
|
177
|
-
second,
|
|
178
|
-
{
|
|
179
|
-
test: /\.(tsx|js|mjs|jsx)$/,
|
|
180
|
-
exclude: shouldExclude,
|
|
181
|
-
use: [
|
|
182
|
-
{
|
|
183
|
-
loader: 'esbuild-loader',
|
|
184
|
-
options: {
|
|
185
|
-
loader: 'tsx',
|
|
186
|
-
minify: false,
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
loader: 'tamagui-loader',
|
|
191
|
-
options: tamaguiOptions,
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
},
|
|
195
|
-
...rest,
|
|
196
|
-
]
|
|
197
|
-
|
|
198
|
-
if (typeof nextConfig.webpack === 'function') {
|
|
199
|
-
return nextConfig.webpack(webpackConfig, options)
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return webpackConfig
|
|
203
|
-
},
|
|
204
|
-
})
|
|
205
|
-
}
|
|
206
|
-
}
|