The bundle of rollup contain an direct import

Viewed 14

I tried to use rollup to package my library, but the resulting package is weird。it looks like

export { default as Test } from './test/test.js';
import './test/context.js';

I don't know why there is a direct import ,it look strange。 the context.js look like

import {createContext} from 'react';

export const context = {provider: null};
export const contextProvider = createContext(null);

but when I delete import from node_modules, and change it to

export const context = {provider: null};
export const contextProvider = null;

the bundle import statement will disappear.

I make a demo to describe the question ,hope somebody can help me. https://github.com/CodeRubbish/rollup-error-demo

0 Answers
Related