UNPKG

1.25 kBJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6exports.nodeResolvePlugin = void 0;
7const dev_server_rollup_1 = require("@web/dev-server-rollup");
8const deepmerge_1 = __importDefault(require("deepmerge"));
9function nodeResolvePlugin(rootDir, preserveSymlinks, userOptions) {
10 const userOptionsObject = typeof userOptions === 'object' ? userOptions : {};
11 const options = (0, deepmerge_1.default)({
12 rootDir,
13 extensions: ['.mjs', '.js', '.cjs', '.jsx', '.json', '.ts', '.tsx'],
14 moduleDirectories: ['node_modules', 'web_modules'],
15 // allow resolving polyfills for nodejs libs
16 preferBuiltins: false,
17 }, userOptionsObject);
18 // use user config exportConditions if present. otherwise use ['development']
19 options.exportConditions = userOptionsObject.exportConditions || ['development'];
20 return (0, dev_server_rollup_1.rollupAdapter)((0, dev_server_rollup_1.nodeResolve)(options), { preserveSymlinks }, { throwOnUnresolvedImport: true });
21}
22exports.nodeResolvePlugin = nodeResolvePlugin;
23//# sourceMappingURL=nodeResolvePlugin.js.map
\No newline at end of file