From fbd59a46990a42dd47875b38dc343da9cfbde6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=89=E6=96=B0=E6=98=8E?= Date: Mon, 11 Nov 2019 11:13:36 +0800 Subject: [PATCH] =?UTF-8?q?feat(stylus):=20=E6=B7=BB=E5=8A=A0stylus?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/config/setWebpackLoaders.js | 24 ++++++++++--------- packages/ice-scripts/package.json | 2 ++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/ice-scripts/lib/config/setWebpackLoaders.js b/packages/ice-scripts/lib/config/setWebpackLoaders.js index ae20fec..c3b6139 100644 --- a/packages/ice-scripts/lib/config/setWebpackLoaders.js +++ b/packages/ice-scripts/lib/config/setWebpackLoaders.js @@ -10,6 +10,7 @@ const CSS_LOADER = require.resolve('css-loader'); const LESS_LOADER = require.resolve('less-loader'); const POSTCSS_LOADER = require.resolve('postcss-loader'); const SASS_LOADER = require.resolve('sass-loader'); +const STYLUS_LOADER = require.resolve('stylus-loader'); const CSS_HOT_LOADER = require.resolve('css-hot-loader'); const URL_LOADER = require.resolve('url-loader'); @@ -92,6 +93,7 @@ module.exports = (chainConfig, mode = 'development') => { setExtraCSSLoader('css'); setExtraCSSLoader('scss', [['sass-loader', SASS_LOADER, {}]]); setExtraCSSLoader('less', [['less-loader', LESS_LOADER, { sourceMap: true, javascriptEnabled: true }]]); + setExtraCSSLoader('styl', [['stylus-loader', STYLUS_LOADER, { preferPathResolver: 'webpack' }]]); // assets loader setAssetsLoader('woff2', /\.woff2?$/, { mimetype: 'application/font-woff' }); @@ -104,23 +106,23 @@ module.exports = (chainConfig, mode = 'development') => { chainConfig.module.rule('jsx') .test(/\.jsx?$/) .exclude - .add(EXCLUDE_REGX) - .end() + .add(EXCLUDE_REGX) + .end() .use('babel-loader') - .loader(BABEL_LOADER) - .options(Object.assign({}, deepClone(babelConfig), { cacheDirectory: true })); + .loader(BABEL_LOADER) + .options(Object.assign({}, deepClone(babelConfig), { cacheDirectory: true })); // tsx loader chainConfig.module.rule('tsx') .test(/\.tsx?$/) .exclude - .add(EXCLUDE_REGX) - .end() + .add(EXCLUDE_REGX) + .end() .use('babel-loader') - .loader(BABEL_LOADER) - .options(Object.assign({}, deepClone(babelConfig), { cacheDirectory: true })) - .end() + .loader(BABEL_LOADER) + .options(Object.assign({}, deepClone(babelConfig), { cacheDirectory: true })) + .end() .use('ts-loader') - .loader(TYPESCRIPT_LOADER) - .options({ transpileOnly: true }); + .loader(TYPESCRIPT_LOADER) + .options({ transpileOnly: true }); }; diff --git a/packages/ice-scripts/package.json b/packages/ice-scripts/package.json index b244485..927ceab 100644 --- a/packages/ice-scripts/package.json +++ b/packages/ice-scripts/package.json @@ -85,6 +85,8 @@ "regenerator-runtime": "^0.13.3", "sass-loader": "^7.1.0", "semver": "^6.1.1", + "stylus": "^0.54.7", + "stylus-loader": "^3.0.2", "ts-loader": "^5.3.3", "typescript": "^3.3.3333", "uglifyjs-webpack-plugin": "^1.3.0",