rollup-plugin-node-resolve:如何解决从node_modules导入笔的问题

问题描述

我在尝试导入带有@import @ package / package.styl的手写笔文件时遇到一些问题,但是没有运气。我正在尝试使用此配置进行构建:

import resolve from 'rollup-plugin-node-resolve';
...
import styles from 'rollup-plugin-styles';
import pkg from './package.json';

export default [
  {
    input: 'src/component.jsx',output: {
      name: 'loader',file: pkg.browser,format: 'umd',},plugins: [
      resolve({
        customResolveOptions: {
          moduleDirectory: './node_modules/',}),commonjs(),babel({
        exclude: ['node_modules/**'],styles({ mode: 'extract' }),],{
    input: 'src/component.jsx',external: ['react'],output: [
      { file: pkg.main,format: 'cjs' },{ file: pkg.module,format: 'es' },plugins: [
      babel({
        exclude: ['node_modules/**'],];

但是我得到这个错误:

> @the-coolest-components-react/loader@0.1.125 build /home/alexander/Workspace/if/the-coolest-components-react/packages/loader
> rollup -c


src/Loader.jsx → ./dist/loader.umd.js...
[!] (plugin styles) Error: /home/alexander/Workspace/if/the-coolest-components-react/packages/loader/node_modules/@the-coolest-system/loader/src/loader.styl:1:10
   1| @require '@the-coolest-system/core/src/scaffolding.styl'
---------------^
   2| @require '@the-coolest-system/util/src/variables.styl'
   3| 
   4| .if.loader.horizontal

failed to locate @require file @the-coolest-system/core/src/scaffolding.styl

我已经在jsx中使用了它,如下所示:

import React from 'react';

import '@the-coolest-system/loader/src/loader.styl';

const component = ({ ...props }) => {

  return ();
};

...

export default component;

我以前为此使用webpack,并使其与resolve-url-loader一起使用,并将node_modules添加到path中的stylus-loader-选项中。我认为rollup-plugin-node-resolver可以解决此问题。有什么想法我在这里做错了吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...