Skip to content

Commit 8f13db3

Browse files
author
farfromrefug
committed
chore: demo
1 parent ef8dbe4 commit 8f13db3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

demo-snippets/webpack.config.vue.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,21 @@ module.exports = (env, webpack) => {
99
};
1010

1111
module.exports.onWebpackConfig = function (config, env, params) {
12-
1312
const platform = env && ((env.android && 'android') || (env.ios && 'ios'));
1413
const dist = nsWebpack.Utils.platform.getDistPath();
1514
console.log('test', env, params, dist);
1615
const projectRoot = nsWebpack.Utils.project.getProjectRootPath();
1716
const appResourcesPath = env.appResourcesPath;
17+
18+
const coreModulesPackageName = env.fork ? '@akylas/nativescript' : '@nativescript/core';
19+
if (env.fork) {
20+
config.resolve.modules = [resolve(projectRoot, `node_modules/${coreModulesPackageName}`), resolve(projectRoot, 'node_modules'), `node_modules/${coreModulesPackageName}`, 'node_modules'];
21+
Object.assign(config.resolve.alias, {
22+
'@nativescript/core': `${coreModulesPackageName}`,
23+
'tns-core-modules': `${coreModulesPackageName}`
24+
});
25+
}
26+
1827
let appVersion;
1928
let buildNumber;
2029
if (platform === 'android') {
@@ -40,7 +49,6 @@ module.exports.onWebpackConfig = function (config, env, params) {
4049
__APP_VERSION__: `"${appVersion}"`,
4150
__APP_BUILD_NUMBER__: `"${buildNumber}"`
4251
});
43-
4452
config.resolve.symlinks = false;
4553
config.devtool = 'source-map';
4654
config.plugins.push(
@@ -57,6 +65,7 @@ module.exports.onWebpackConfig = function (config, env, params) {
5765
cleanArtifacts: true
5866
},
5967
sourcemaps: {
68+
rewriteSources: (source, map) => source.replace('webpack:///', 'webpack://'),
6069
ignore: ['tns-java-classes', 'hot-update'],
6170
assets: [dist + '/**/*.js', join(dist, process.env.SOURCEMAP_REL_DIR) + '/*.map']
6271
}

0 commit comments

Comments
 (0)