Skip to content

Instantly share code, notes, and snippets.

@wincent
Created April 23, 2019 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wincent/cbe5b7cf26c03ce86b0a420083eabb89 to your computer and use it in GitHub Desktop.
Save wincent/cbe5b7cf26c03ce86b0a420083eabb89 to your computer and use it in GitHub Desktop.
/**
* For windows compatibility, we need to use windows path separators for webpack
* "test" properties.
*/
function toTestRegExp(file) {
return new RegExp(
file.split('/').join(path.sep).replace(/\\/g, '\\')
);
}
const base = {
/**
* https://webpack.js.org/configuration/entry-context/
*/
context: toAbsolute('.'),
/**
* https://webpack.js.org/configuration/module/
*/
module: {
rules: [
{
test: /\.(js|jsx)$/,
include: toAbsolute('./src'),
loader: 'babel-loader',
},
{
test: toTestRegExp('scripts/build/version.js'),
use: {
loader: 'val-loader',
},
},
],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment