Skip to content

Commit

Permalink
[patch] optionalRequire archetype/config folder for component archety…
Browse files Browse the repository at this point in the history
…pe (#733)

* optionalRequire archetype/config folder for component archetype

* optimize initial value
  • Loading branch information
didi0613 authored and jchip committed Mar 6, 2018
1 parent 2629213 commit 74298d2
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const Path = require("path");
const glob = require("glob");
const optionalRequire = require("optional-require")(require);

const atImport = require("postcss-import");
const cssnext = require("postcss-cssnext");
Expand All @@ -14,12 +15,10 @@ const stylusLoader = require.resolve("stylus-relative-loader");
const sassLoader = require.resolve("sass-loader");

const demoAppPath = Path.resolve(process.cwd(), "..", "..", "demo-app");
const archetypeAppPath = Path.resolve(
demoAppPath,
"archetype",
"config"
);
const archetypeAppWebpack = require(archetypeAppPath).webpack;
const archetypeAppPath = Path.resolve(demoAppPath, "archetype", "config");

const archetypeApp = optionalRequire(archetypeAppPath) || { webpack: {} };
const archetypeAppWebpack = archetypeApp.webpack;
let cssModuleSupport = archetypeAppWebpack.cssModuleSupport;
const cssModuleStylusSupport = archetypeAppWebpack.cssModuleStylusSupport;

Expand Down Expand Up @@ -72,8 +71,8 @@ module.exports = function() {
use: cssModuleSupport ? cssModuleQuery : cssQuery
},
{
test: /\.scss$/,
use: cssModuleSupport ? cssScssQuery : scssQuery
test: /\.scss$/,
use: cssModuleSupport ? cssScssQuery : scssQuery
},
{
test: /\.styl$/,
Expand Down

0 comments on commit 74298d2

Please sign in to comment.