-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnativescript.webpack.js
More file actions
30 lines (25 loc) · 1.11 KB
/
nativescript.webpack.js
File metadata and controls
30 lines (25 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const path = require('path');
const Webpack = require('webpack');
/**
* @param {typeof import('@nativescript/webpack')} webpack
*/
module.exports = (webpack) => {
webpack.mergeWebpack((config) => {
const shimPath = path.resolve(__dirname, 'solid-web-shim.js');
const jsxRuntimeShimPath = path.resolve(__dirname, 'solid-js-jsx-runtime-shim.js');
if (!config.resolve) {
config.resolve = {};
}
if (!config.resolve.alias) {
config.resolve.alias = {};
}
config.resolve.alias['solid-js/web$'] = shimPath;
config.resolve.alias['solid-js/web'] = shimPath;
config.resolve.alias['solid-js/jsx-runtime$'] = jsxRuntimeShimPath;
config.resolve.alias['solid-js/jsx-dev-runtime$'] = jsxRuntimeShimPath;
config.plugins = config.plugins || [];
config.plugins.push(new Webpack.NormalModuleReplacementPlugin(/^solid-js\/web$/, shimPath));
config.plugins.push(new Webpack.NormalModuleReplacementPlugin(/^solid-js\/jsx-runtime$/, jsxRuntimeShimPath));
config.plugins.push(new Webpack.NormalModuleReplacementPlugin(/^solid-js\/jsx-dev-runtime$/, jsxRuntimeShimPath));
});
};