Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
helloyou2012 committed Jun 12, 2019
1 parent c750cee commit 6239e39
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
"@babel/preset-react": "^7.0.0",
"autoprefixer": "^9.6.0",
"babel-loader": "^8.0.6",
"css-loader": "^2.1.1",
"css-loader": "^3.0.0",
"cssnano": "^4.1.10",
"dool-init": "^2.0.2",
"etpl-loader": "^1.0.0",
"file-loader": "^3.0.1",
"file-loader": "^4.0.0",
"fs-extra": "^8.0.1",
"glob": "^7.1.4",
"ip": "^1.1.5",
Expand All @@ -65,9 +65,9 @@
"mini-css-extract-plugin": "^0.7.0",
"postcss-loader": "^3.0.0",
"style-loader": "^0.23.1",
"url-loader": "^1.1.2",
"url-loader": "^2.0.0",
"webpack": "^4.33.0",
"webpack-dev-server": "^3.5.1",
"webpack-dev-server": "^3.7.1",
"webpack-manifest-plugin": "^2.0.4",
"worker-farm": "^1.7.0",
"yargs": "^13.2.4"
Expand Down
5 changes: 3 additions & 2 deletions src/config/getRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ function getStyleRule ({

// config css-loader
const cssExtraOptions = modules ? {
modules: true,
localIdentName: '[local]_[hash:base64:5]'
modules: {
localIdentName: '[local]_[hash:base64:5]'
}
} : {};
const css = {
loader: 'css-loader',
Expand Down
26 changes: 15 additions & 11 deletions test/expect/css-modules-injs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ console.log(_index_css__WEBPACK_IMPORTED_MODULE_0___default.a);
exports = module.exports = __webpack_require__(3)(false);
// Module
exports.push([module.i, ".global-class-name {\n color: green;\n}\n.normal_1NnZ5 {\n color: red;\n}", ""]);

// Exports
exports.locals = {
"normal": "normal_1NnZ5"
Expand All @@ -145,6 +144,7 @@ exports.locals = {
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
// eslint-disable-next-line func-names
module.exports = function (useSourceMap) {
var list = []; // return the list of modules as css string

Expand All @@ -153,31 +153,34 @@ module.exports = function (useSourceMap) {
var content = cssWithMappingToString(item, useSourceMap);

if (item[2]) {
return '@media ' + item[2] + '{' + content + '}';
} else {
return content;
return "@media ".concat(item[2], "{").concat(content, "}");
}

return content;
}).join('');
}; // import a list of modules into the list
// eslint-disable-next-line func-names


list.i = function (modules, mediaQuery) {
if (typeof modules === 'string') {
// eslint-disable-next-line no-param-reassign
modules = [[null, modules, '']];
}

var alreadyImportedModules = {};

for (var i = 0; i < this.length; i++) {
// eslint-disable-next-line prefer-destructuring
var id = this[i][0];

if (id != null) {
alreadyImportedModules[id] = true;
}
}

for (i = 0; i < modules.length; i++) {
var item = modules[i]; // skip already imported module
for (var _i = 0; _i < modules.length; _i++) {
var item = modules[_i]; // skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
Expand All @@ -186,7 +189,7 @@ module.exports = function (useSourceMap) {
if (mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if (mediaQuery) {
item[2] = '(' + item[2] + ') and (' + mediaQuery + ')';
item[2] = "(".concat(item[2], ") and (").concat(mediaQuery, ")");
}

list.push(item);
Expand All @@ -198,7 +201,8 @@ module.exports = function (useSourceMap) {
};

function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || '';
var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring

var cssMapping = item[3];

if (!cssMapping) {
Expand All @@ -208,7 +212,7 @@ function cssWithMappingToString(item, useSourceMap) {
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */';
return "/*# sourceURL=".concat(cssMapping.sourceRoot).concat(source, " */");
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
Expand All @@ -220,8 +224,8 @@ function cssWithMappingToString(item, useSourceMap) {
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
return '/*# ' + data + ' */';
var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
return "/*# ".concat(data, " */");
}

/***/ }),
Expand Down

0 comments on commit 6239e39

Please sign in to comment.