Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 3df5d9b

Browse files
committed
fix(ns-bundle): use webpack.config.js instead of webpack.common.js
BREAKING: The ns-bundle script will now target the `webpack.config.js` file in your repository instead of the `webpack.common.js` one. If you changed your configuration, you need to apply them to `webpack.config.js` or replace the whole file with your correct configuration. The following files are no longer needed and can be safely removed from the project: `webpack.common.js`, `webpack.android.js`, `webpack.ios.js`.
1 parent 3d690cb commit 3df5d9b

8 files changed

+21
-18
lines changed

Diff for: bin/ns-bundle

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/usr/bin/env node
22

3-
const spawn = require("child_process").spawn;
4-
const resolve = require("path").resolve;
3+
const { spawn } = require("child_process");
4+
const { resolve: pathResolve } = require("path");
5+
const { getPackageJson } = require("../projectHelpers");
56

6-
const getPackageJson = require("../projectHelpers").getPackageJson;
7-
8-
const PROJECT_DIR = resolve(__dirname, "../../../");
7+
const PROJECT_DIR = pathResolve(__dirname, "../../../");
98
const packageJson = getPackageJson(PROJECT_DIR);
109

1110
if (!process.env.npm_config_argv) {
@@ -70,7 +69,7 @@ function webpack(platform) {
7069
const args = [
7170
true, // show output on console
7271
`webpack`,
73-
`--config=webpack.common.js`,
72+
`--config=webpack.config.js`,
7473
`--progress`,
7574
`--env.${platform}`,
7675
process.env.npm_config_uglify && `--env.uglify`,

Diff for: projectFilesManager.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ function getProjectTemplates(projectDir) {
5353
let templates = {}
5454

5555
if (helpers.isAngular({projectDir})) {
56-
templates["webpack.common.js.ng.template"] = "webpack.common.js";
56+
templates["webpack.config.js.ng.template"] = "webpack.config.js";
5757
templates["tsconfig.aot.json.template"] = "tsconfig.aot.json";
5858
} else if (helpers.isTypeScript({projectDir})) {
59-
templates["webpack.common.js.ts.template"] = "webpack.common.js";
59+
templates["webpack.config.js.ts.template"] = "webpack.config.js";
6060
} else {
61-
templates["webpack.common.js.js.template"] = "webpack.common.js";
61+
templates["webpack.config.js.js.template"] = "webpack.config.js";
6262
}
6363

6464
return getFullTemplatesPath(projectDir, templates);

Diff for: templates/buildTemplates.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ saveTemplate("ng");
66

77
function saveTemplate(target) {
88
const content = buildTemplate(target);
9-
writeFileSync(`./templates/webpack.common.js.${target}.template`, content);
9+
writeFileSync(`./templates/webpack.config.js.${target}.template`, content);
1010
}
1111

1212
function buildTemplate(target) {

Diff for: templates/common/imports.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
module.exports = `
2-
const { resolve, join } = require("path");
1+
module.exports = `const { resolve, join } = require("path");
32
43
const webpack = require("webpack");
54
const nsWebpack = require("nativescript-dev-webpack");

Diff for: templates/ts/rules.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
module.exports = [
1+
module.exports = `
22
// Compile TypeScript files, replace templateUrl and styleUrls.
33
{
44
test: /\\.ts$/,
55
loaders: [
66
"awesome-typescript-loader",
77
]
88
}
9-
];
9+
`;

Diff for: templates/webpack.common.js.js.template renamed to templates/webpack.config.js.js.template

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
const { resolve, join } = require("path");
32

43
const webpack = require("webpack");

Diff for: templates/webpack.common.js.ng.template renamed to templates/webpack.config.js.ng.template

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
const { resolve, join } = require("path");
32

43
const webpack = require("webpack");

Diff for: templates/webpack.common.js.ts.template renamed to templates/webpack.config.js.ts.template

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
const { resolve, join } = require("path");
32

43
const webpack = require("webpack");
@@ -107,7 +106,15 @@ function getRules() {
107106
]
108107
},
109108

110-
[object Object]
109+
110+
// Compile TypeScript files, replace templateUrl and styleUrls.
111+
{
112+
test: /\.ts$/,
113+
loaders: [
114+
"awesome-typescript-loader",
115+
]
116+
}
117+
111118
];
112119
}
113120

0 commit comments

Comments
 (0)