Fix windows builds breaking due to mixed paths

This commit is contained in:
Jason Miller
2020-07-14 11:29:25 -04:00
committed by Ingvar Stepanyan
parent 17ffa57a8b
commit cf1a718534
4 changed files with 27 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ const DtsCreator = require('typed-css-modules');
const chokidar = require('chokidar');
const util = require('util');
const sass = require('node-sass');
const normalizePath = require('normalize-path');
const sassRender = util.promisify(sass.render);
@@ -29,9 +30,10 @@ function addCssTypes(rootPaths, opts = {}) {
let ready = false;
for (const rootPath of rootPaths) {
const rootPathUnix = normalizePath(rootPath);
// Look for scss & css in each path.
paths.push(rootPath + '/**/*.scss');
paths.push(rootPath + '/**/*.css');
paths.push(rootPathUnix + '/**/*.scss');
paths.push(rootPathUnix + '/**/*.css');
}
// For simplicity, the watcher is used even if we're not watching.
@@ -68,7 +70,7 @@ function addCssTypes(rootPaths, opts = {}) {
// And if we're not watching, close the watcher.
if (!watch) watcher.close();
});
})
});
}
module.exports = addCssTypes;

22
package-lock.json generated
View File

@@ -1775,6 +1775,17 @@
"requires": {
"micromatch": "^3.1.4",
"normalize-path": "^2.1.1"
},
"dependencies": {
"normalize-path": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
"integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
"dev": true,
"requires": {
"remove-trailing-separator": "^1.0.1"
}
}
}
},
"aproba": {
@@ -9953,13 +9964,10 @@
}
},
"normalize-path": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz",
"integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=",
"dev": true,
"requires": {
"remove-trailing-separator": "^1.0.1"
}
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true
},
"normalize-url": {
"version": "2.0.1",

View File

@@ -45,6 +45,7 @@
"minimatch": "3.0.4",
"node-fetch": "2.6.0",
"node-sass": "4.13.0",
"normalize-path": "^3.0.0",
"optimize-css-assets-webpack-plugin": "5.0.1",
"pointer-tracker": "2.0.3",
"preact": "8.4.2",

View File

@@ -22,10 +22,10 @@ module.exports = async function (_, env) {
const isProd = env.mode === 'production';
const nodeModules = path.join(__dirname, 'node_modules');
const componentStyleDirs = [
path.join(__dirname, 'src/components'),
path.join(__dirname, 'src/codecs'),
path.join(__dirname, 'src/custom-els'),
path.join(__dirname, 'src/lib'),
path.join(__dirname, 'src', 'components'),
path.join(__dirname, 'src', 'codecs'),
path.join(__dirname, 'src', 'custom-els'),
path.join(__dirname, 'src', 'lib')
];
await addCssTypes(componentStyleDirs, { watch: !isProd });
@@ -53,7 +53,7 @@ module.exports = async function (_, env) {
resolveLoader: {
alias: {
// async-component-loader returns a wrapper component that waits for the import to load before rendering:
async: path.join(__dirname, 'config/async-component-loader')
async: path.join(__dirname, 'config', 'async-component-loader')
}
},
module: {
@@ -143,7 +143,7 @@ module.exports = async function (_, env) {
{
// All the codec files define a global with the same name as their file name. `exports-loader` attaches those to `module.exports`.
test: /\.js$/,
include: path.join(__dirname, 'src/codecs'),
include: path.join(__dirname, 'src', 'codecs'),
loader: 'exports-loader'
},
{