Error: Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)

https://www.cnblogs.com/xulei1992/p/15176992.html

https://segmentfault.com/a/1190000038956767

tsdx.config.js

const postcss = require('rollup-plugin-postcss');
const images = require('@rollup/plugin-image');

module.exports = {
  rollup(config, options) {
    config.plugins = [
      postcss({
        inject: true,
        extract: !!options.writeMeta,
        modules: true, // 使用css modules
        namedExport: true, // 类名导出
        camelCase: true, // 支持驼峰
        sass: true, // 是否使用sass
        // less:true,
        autoModules:true,
        namedExports(name) {
        // Maybe you simply want to convert dash to underscore
        return name.replace(/-/g, '_')
        }
      }),
      images({ include: ['**/*.png', '**/*.jpg', '**/*.svg'] }),
      ...config.plugins,
    ];
    return config;
  },
};

 

posted @ 2021-08-23 17:49  Redchar  阅读(2015)  评论(0编辑  收藏  举报