当我运行汇总以输出我的React JSX文件时,包括在index.es.js和index.js中,如下所示:
var _jsxFileName = '/Users/<name>/<path>/<to>/component-lib/src/button/Button.js',
对于我的Button组件。当不同的开发人员进行汇总构建时,这会产生合并冲突。
是否有一种简便的方法可以从文件中删除此路径? 理想情况是:
var _jsxFileName = '/component-lib/src/button/Button.js',
这是我当前的汇总配置:
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import external from 'rollup-plugin-peer-deps-external'
import postcss from 'rollup-plugin-postcss'
import resolve from 'rollup-plugin-node-resolve'
import url from 'rollup-plugin-url'
import svgr from '@svgr/rollup'
import pkg from './package.json'
const path = require("path");
process.env.NODE_ENV = 'development';
// console.log('resolve', resolve().options);
// console.log('url', url({
// sourceDir: path.join(__dirname, "src"),
// fileName: "[hash][name][extname]",
// publicPath: "/"
// }));
export default {
input: 'src/index.js',
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true,
entryFileNames:"entry-[name].js"
},
{
file: pkg.module,
format: 'es',
sourcemap: true,
entryFileNames:"entry-[name].js"
}
],
plugins: [
external(),
postcss({
modules: true
}),
url({
// sourceDir: path.join(__dirname, "src"),
// fileName: "[hash][name][extname]",
// publicPath: "/"
}),
svgr(),
babel({
exclude: 'node_modules/**',
plugins: [ 'external-helpers' ]
}),
resolve(),
commonjs()
]
}