Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7670e33

Browse files
author
Dimitar Tachev
authoredApr 4, 2019
fix: update the css loader in order to fix a bug with leading dashes of css classes (#847)
1 parent dc6210d commit 7670e33

File tree

8 files changed

+105
-105
lines changed

8 files changed

+105
-105
lines changed
 

‎demo/AngularApp/webpack.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ module.exports = env => {
198198
test: /[\/|\\]app\.css$/,
199199
use: [
200200
"nativescript-dev-webpack/style-hot-loader",
201-
{ loader: "css-loader", options: { minimize: false, url: false } }
201+
{ loader: "css-loader", options: { url: false } }
202202
]
203203
},
204204
{
205205
test: /[\/|\\]app\.scss$/,
206206
use: [
207207
"nativescript-dev-webpack/style-hot-loader",
208-
{ loader: "css-loader", options: { minimize: false, url: false } },
208+
{ loader: "css-loader", options: { url: false } },
209209
"sass-loader"
210210
]
211211
},

‎demo/JavaScriptApp/webpack.config.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ module.exports = env => {
102102
"__dirname": false,
103103
},
104104
devtool: sourceMap ? "inline-source-map" : "none",
105-
optimization: {
105+
optimization: {
106106
splitChunks: {
107107
cacheGroups: {
108108
vendor: {
@@ -111,7 +111,7 @@ module.exports = env => {
111111
test: (module, chunks) => {
112112
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
113113
return /[\\/]node_modules[\\/]/.test(moduleName) ||
114-
appComponents.some(comp => comp === moduleName);
114+
appComponents.some(comp => comp === moduleName);
115115

116116
},
117117
enforce: true,
@@ -172,17 +172,17 @@ module.exports = env => {
172172
use: "nativescript-dev-webpack/markup-hot-loader"
173173
},
174174

175-
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"},
175+
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" },
176176

177177
{
178178
test: /\.css$/,
179-
use: { loader: "css-loader", options: { minimize: false, url: false } }
179+
use: { loader: "css-loader", options: { url: false } }
180180
},
181181

182182
{
183183
test: /\.scss$/,
184184
use: [
185-
{ loader: "css-loader", options: { minimize: false, url: false } },
185+
{ loader: "css-loader", options: { url: false } },
186186
"sass-loader"
187187
]
188188
},
@@ -195,14 +195,14 @@ module.exports = env => {
195195
"process": undefined,
196196
}),
197197
// Remove all files from the out dir.
198-
new CleanWebpackPlugin([ `${dist}/**/*` ]),
199-
// Copy native app resources to out dir.
198+
new CleanWebpackPlugin([`${dist}/**/*`]),
199+
// Copy native app resources to out dir.
200200
new CopyWebpackPlugin([
201-
{
202-
from: `${appResourcesFullPath}/${appResourcesPlatformDir}`,
203-
to: `${dist}/App_Resources/${appResourcesPlatformDir}`,
204-
context: projectRoot
205-
},
201+
{
202+
from: `${appResourcesFullPath}/${appResourcesPlatformDir}`,
203+
to: `${dist}/App_Resources/${appResourcesPlatformDir}`,
204+
context: projectRoot
205+
},
206206
]),
207207
// Copy assets to out dir. Add your own globs as needed.
208208
new CopyWebpackPlugin([

‎demo/TypeScriptApp/webpack.config.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ module.exports = env => {
104104
"__dirname": false,
105105
},
106106
devtool: sourceMap ? "inline-source-map" : "none",
107-
optimization: {
107+
optimization: {
108108
splitChunks: {
109109
cacheGroups: {
110110
vendor: {
@@ -113,7 +113,7 @@ module.exports = env => {
113113
test: (module, chunks) => {
114114
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
115115
return /[\\/]node_modules[\\/]/.test(moduleName) ||
116-
appComponents.some(comp => comp === moduleName);
116+
appComponents.some(comp => comp === moduleName);
117117

118118
},
119119
enforce: true,
@@ -174,17 +174,17 @@ module.exports = env => {
174174
use: "nativescript-dev-webpack/markup-hot-loader"
175175
},
176176

177-
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"},
177+
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" },
178178

179179
{
180180
test: /\.css$/,
181-
use: { loader: "css-loader", options: { minimize: false, url: false } }
181+
use: { loader: "css-loader", options: { url: false } }
182182
},
183183

184184
{
185185
test: /\.scss$/,
186186
use: [
187-
{ loader: "css-loader", options: { minimize: false, url: false } },
187+
{ loader: "css-loader", options: { url: false } },
188188
"sass-loader"
189189
]
190190
},
@@ -209,14 +209,14 @@ module.exports = env => {
209209
"process": undefined,
210210
}),
211211
// Remove all files from the out dir.
212-
new CleanWebpackPlugin([ `${dist}/**/*` ]),
212+
new CleanWebpackPlugin([`${dist}/**/*`]),
213213
// Copy native app resources to out dir.
214214
new CopyWebpackPlugin([
215-
{
216-
from: `${appResourcesFullPath}/${appResourcesPlatformDir}`,
217-
to: `${dist}/App_Resources/${appResourcesPlatformDir}`,
218-
context: projectRoot
219-
},
215+
{
216+
from: `${appResourcesFullPath}/${appResourcesPlatformDir}`,
217+
to: `${dist}/App_Resources/${appResourcesPlatformDir}`,
218+
context: projectRoot
219+
},
220220
]),
221221
// Copy assets to out dir. Add your own globs as needed.
222222
new CopyWebpackPlugin([

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"@angular-devkit/core": "~7.2.0",
7878
"clean-webpack-plugin": "~1.0.0",
7979
"copy-webpack-plugin": "~4.6.0",
80-
"css-loader": "~1.0.0",
80+
"css-loader": "~2.1.1",
8181
"global-modules-path": "2.0.0",
8282
"minimatch": "3.0.4",
8383
"nativescript-hook": "0.2.4",

‎templates/webpack.angular.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ module.exports = env => {
209209
test: /[\/|\\]app\.css$/,
210210
use: [
211211
"nativescript-dev-webpack/style-hot-loader",
212-
{ loader: "css-loader", options: { minimize: false, url: false } }
212+
{ loader: "css-loader", options: { url: false } }
213213
]
214214
},
215215
{
216216
test: /[\/|\\]app\.scss$/,
217217
use: [
218218
"nativescript-dev-webpack/style-hot-loader",
219-
{ loader: "css-loader", options: { minimize: false, url: false } },
219+
{ loader: "css-loader", options: { url: false } },
220220
"sass-loader"
221221
]
222222
},

‎templates/webpack.javascript.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
88
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
99
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
1010
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
11-
const hashSalt = Date.now().toString();
11+
const hashSalt = Date.now().toString();
1212

1313
module.exports = env => {
1414
// Add your custom Activities, Services and other android app components here.
@@ -113,7 +113,7 @@ module.exports = env => {
113113
test: (module, chunks) => {
114114
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
115115
return /[\\/]node_modules[\\/]/.test(moduleName) ||
116-
appComponents.some(comp => comp === moduleName);
116+
appComponents.some(comp => comp === moduleName);
117117

118118
},
119119
enforce: true,
@@ -177,17 +177,17 @@ module.exports = env => {
177177
use: "nativescript-dev-webpack/markup-hot-loader"
178178
},
179179

180-
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"},
180+
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" },
181181

182182
{
183183
test: /\.css$/,
184-
use: { loader: "css-loader", options: { minimize: false, url: false } }
184+
use: { loader: "css-loader", options: { url: false } }
185185
},
186186

187187
{
188188
test: /\.scss$/,
189189
use: [
190-
{ loader: "css-loader", options: { minimize: false, url: false } },
190+
{ loader: "css-loader", options: { url: false } },
191191
"sass-loader"
192192
]
193193
},
@@ -200,7 +200,7 @@ module.exports = env => {
200200
"process": undefined,
201201
}),
202202
// Remove all files from the out dir.
203-
new CleanWebpackPlugin([ `${dist}/**/*` ]),
203+
new CleanWebpackPlugin([`${dist}/**/*`]),
204204
// Copy assets to out dir. Add your own globs as needed.
205205
new CopyWebpackPlugin([
206206
{ from: { glob: "fonts/**" } },
@@ -213,10 +213,10 @@ module.exports = env => {
213213
// configures the WebPack runtime to be generated inside the snapshot
214214
// module and no `runtime.js` module exist.
215215
(snapshot ? [] : ["./runtime"])
216-
.concat([
217-
"./vendor",
218-
"./bundle",
219-
])
216+
.concat([
217+
"./vendor",
218+
"./bundle",
219+
])
220220
),
221221
// For instructions on how to set up workers with webpack
222222
// check out https://github.com/nativescript/worker-loader

‎templates/webpack.typescript.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const CopyWebpackPlugin = require("copy-webpack-plugin");
88
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
99
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
1010
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
11-
const hashSalt = Date.now().toString();
11+
const hashSalt = Date.now().toString();
1212

1313
module.exports = env => {
1414
// Add your custom Activities, Services and other Android app components here.
@@ -115,7 +115,7 @@ module.exports = env => {
115115
test: (module, chunks) => {
116116
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
117117
return /[\\/]node_modules[\\/]/.test(moduleName) ||
118-
appComponents.some(comp => comp === moduleName);
118+
appComponents.some(comp => comp === moduleName);
119119

120120
},
121121
enforce: true,
@@ -179,17 +179,17 @@ module.exports = env => {
179179
use: "nativescript-dev-webpack/markup-hot-loader"
180180
},
181181

182-
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"},
182+
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" },
183183

184184
{
185185
test: /\.css$/,
186-
use: { loader: "css-loader", options: { minimize: false, url: false } }
186+
use: { loader: "css-loader", options: { url: false } }
187187
},
188188

189189
{
190190
test: /\.scss$/,
191191
use: [
192-
{ loader: "css-loader", options: { minimize: false, url: false } },
192+
{ loader: "css-loader", options: { url: false } },
193193
"sass-loader"
194194
]
195195
},
@@ -213,7 +213,7 @@ module.exports = env => {
213213
"process": undefined,
214214
}),
215215
// Remove all files from the out dir.
216-
new CleanWebpackPlugin([ `${dist}/**/*` ]),
216+
new CleanWebpackPlugin([`${dist}/**/*`]),
217217
// Copy assets to out dir. Add your own globs as needed.
218218
new CopyWebpackPlugin([
219219
{ from: { glob: "fonts/**" } },
@@ -226,10 +226,10 @@ module.exports = env => {
226226
// configures the WebPack runtime to be generated inside the snapshot
227227
// module and no `runtime.js` module exist.
228228
(snapshot ? [] : ["./runtime"])
229-
.concat([
230-
"./vendor",
231-
"./bundle",
232-
])
229+
.concat([
230+
"./vendor",
231+
"./bundle",
232+
])
233233
),
234234
// For instructions on how to set up workers with webpack
235235
// check out https://github.com/nativescript/worker-loader

‎templates/webpack.vue.js

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const NsVueTemplateCompiler = require("nativescript-vue-template-compiler");
1212
const nsWebpack = require("nativescript-dev-webpack");
1313
const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target");
1414
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
15-
const hashSalt = Date.now().toString();
15+
const hashSalt = Date.now().toString();
1616

1717
module.exports = env => {
1818
// Add your custom Activities, Services and other android app components here.
@@ -155,62 +155,62 @@ module.exports = env => {
155155
},
156156
module: {
157157
rules: [{
158-
test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath + ".(js|ts)"),
159-
use: [
160-
// Require all Android app components
161-
platform === "android" && {
162-
loader: "nativescript-dev-webpack/android-app-components-loader",
163-
options: { modules: appComponents },
164-
},
158+
test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath + ".(js|ts)"),
159+
use: [
160+
// Require all Android app components
161+
platform === "android" && {
162+
loader: "nativescript-dev-webpack/android-app-components-loader",
163+
options: { modules: appComponents },
164+
},
165165

166-
{
167-
loader: "nativescript-dev-webpack/bundle-config-loader",
168-
options: {
169-
registerPages: true, // applicable only for non-angular apps
170-
loadCss: !snapshot, // load the application css if in debug mode
171-
unitTesting,
172-
appFullPath,
173-
projectRoot,
174-
},
166+
{
167+
loader: "nativescript-dev-webpack/bundle-config-loader",
168+
options: {
169+
registerPages: true, // applicable only for non-angular apps
170+
loadCss: !snapshot, // load the application css if in debug mode
171+
unitTesting,
172+
appFullPath,
173+
projectRoot,
175174
},
176-
].filter(loader => Boolean(loader)),
177-
},
178-
{
179-
test: /\.css$/,
180-
use: [
181-
'nativescript-dev-webpack/style-hot-loader',
182-
'nativescript-dev-webpack/apply-css-loader.js',
183-
{ loader: "css-loader", options: { minimize: false, url: false } },
184-
],
185-
},
186-
{
187-
test: /\.scss$/,
188-
use: [
189-
'nativescript-dev-webpack/style-hot-loader',
190-
'nativescript-dev-webpack/apply-css-loader.js',
191-
{ loader: "css-loader", options: { minimize: false, url: false } },
192-
"sass-loader",
193-
],
194-
},
195-
{
196-
test: /\.js$/,
197-
loader: 'babel-loader',
198-
},
199-
{
200-
test: /\.ts$/,
201-
loader: 'ts-loader',
202-
options: {
203-
appendTsSuffixTo: [/\.vue$/],
204-
allowTsInNodeModules: true,
205175
},
176+
].filter(loader => Boolean(loader)),
177+
},
178+
{
179+
test: /\.css$/,
180+
use: [
181+
'nativescript-dev-webpack/style-hot-loader',
182+
'nativescript-dev-webpack/apply-css-loader.js',
183+
{ loader: "css-loader", options: { url: false } },
184+
],
185+
},
186+
{
187+
test: /\.scss$/,
188+
use: [
189+
'nativescript-dev-webpack/style-hot-loader',
190+
'nativescript-dev-webpack/apply-css-loader.js',
191+
{ loader: "css-loader", options: { url: false } },
192+
"sass-loader",
193+
],
194+
},
195+
{
196+
test: /\.js$/,
197+
loader: 'babel-loader',
198+
},
199+
{
200+
test: /\.ts$/,
201+
loader: 'ts-loader',
202+
options: {
203+
appendTsSuffixTo: [/\.vue$/],
204+
allowTsInNodeModules: true,
206205
},
207-
{
208-
test: /\.vue$/,
209-
loader: "vue-loader",
210-
options: {
211-
compiler: NsVueTemplateCompiler,
212-
},
206+
},
207+
{
208+
test: /\.vue$/,
209+
loader: "vue-loader",
210+
options: {
211+
compiler: NsVueTemplateCompiler,
213212
},
213+
},
214214
],
215215
},
216216
plugins: [
@@ -236,10 +236,10 @@ module.exports = env => {
236236
// configures the WebPack runtime to be generated inside the snapshot
237237
// module and no `runtime.js` module exist.
238238
(snapshot ? [] : ["./runtime"])
239-
.concat([
240-
"./vendor",
241-
"./bundle",
242-
])
239+
.concat([
240+
"./vendor",
241+
"./bundle",
242+
])
243243
),
244244
// For instructions on how to set up workers with webpack
245245
// check out https://github.com/nativescript/worker-loader
@@ -264,7 +264,7 @@ module.exports = env => {
264264
use: "nativescript-dev-webpack/markup-hot-loader"
265265
},
266266

267-
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader"}
267+
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" }
268268
);
269269
}
270270

0 commit comments

Comments
 (0)
This repository has been archived.