make webpack exclude work
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": {
|
||||
"browsers": ["> 1%", "android >= 4.4.4", "ios >= 9", "IE >= 11"]
|
||||
},
|
||||
"useBuiltIns": "usage",
|
||||
"corejs": 3
|
||||
}
|
||||
],
|
||||
[
|
||||
"@babel/preset-react",
|
||||
{
|
||||
"pragma": "h",
|
||||
"pragmaFrag": "div"
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": ["@babel/plugin-syntax-dynamic-import", ["@babel/plugin-transform-react-jsx", { "pragma": "h" }]]
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: {
|
||||
browsers: ['> 1%', 'android >= 4.4.4', 'ios >= 9', 'IE >= 11'],
|
||||
},
|
||||
useBuiltIns: 'usage',
|
||||
corejs: 3,
|
||||
},
|
||||
],
|
||||
[
|
||||
'@babel/preset-react',
|
||||
{
|
||||
pragma: 'h',
|
||||
pragmaFrag: 'div',
|
||||
},
|
||||
],
|
||||
],
|
||||
plugins: ['@babel/plugin-syntax-dynamic-import', ['@babel/plugin-transform-react-jsx', { pragma: 'h' }]],
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
public
|
||||
!.prettierrc.js
|
||||
!.eslintrc.js
|
||||
!.babelrc.js
|
||||
@@ -27,12 +27,17 @@ console.log(`REMARK_ENV = ${remarkUrl}`);
|
||||
* so we have to exclude from ignore these modules
|
||||
*/
|
||||
function getExcluded() {
|
||||
const modules = ['markdown-toolbar-element'];
|
||||
const modules = ['@github/markdown-toolbar-element'];
|
||||
const exclude = new RegExp(`node_modules\\/(?!(${modules.map(m => m.replace(/\//g, '\\/')).join('|')})\\/).*`);
|
||||
|
||||
return { exclude };
|
||||
return {
|
||||
exclude,
|
||||
};
|
||||
}
|
||||
|
||||
// console.log(getExcluded())
|
||||
// process.exit(1)
|
||||
|
||||
const commonStyleLoaders = [
|
||||
'css-loader',
|
||||
{
|
||||
@@ -52,6 +57,8 @@ const commonStyleLoaders = [
|
||||
},
|
||||
];
|
||||
|
||||
const babelConfigPath = path.resolve(__dirname, './.babelrc.js');
|
||||
|
||||
module.exports = () => ({
|
||||
context: __dirname,
|
||||
devtool: env === 'development' ? 'source-map' : false,
|
||||
@@ -76,12 +83,12 @@ module.exports = () => ({
|
||||
rules: [
|
||||
{
|
||||
test: /\.js(x?)$/,
|
||||
use: 'babel-loader',
|
||||
use: [{ loader: 'babel-loader', options: { configFile: babelConfigPath } }],
|
||||
...getExcluded(),
|
||||
},
|
||||
{
|
||||
test: /\.ts(x?)$/,
|
||||
use: ['babel-loader', 'ts-loader'],
|
||||
use: [{ loader: 'babel-loader', options: { configFile: babelConfigPath } }, 'ts-loader'],
|
||||
...getExcluded(),
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user