create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

How to exclude specific files while compling

Open Panepo opened this issue 8 years ago • 5 comments

Is this a bug report?

No, this issue is a question.

Hi there,

I was trying to build an app with a custom library, and the file is compressed to a .min.js. But I get a lot of error while compling, any way I can exclude that file while compling?

Thanks

Panepo avatar Nov 22 '18 09:11 Panepo

It doesn't sound like a CRA related issue? It'd be better if you can provide your error logs or a reproducible example :)

konekoya avatar Nov 22 '18 10:11 konekoya

Hi @konekoya

Here's the log:

> yarn start
yarn run v1.9.4
$ react-scripts start
Starting the development server...

[BABEL] Note: The code generator has deoptimised the styling of D:\Github\Kikuzuki\src\library\tf.min.js as it exceeds the max of 500KB.
Failed to compile.

./src/library/tf.min.js
  Line 2:       Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 5:      'define' is not defined                                                no-undef
  Line 6:       'define' is not defined                                                no-undef
  Line 23:      Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 109:    Expected an assignment or function call and instead saw an expression  no-unused-expressions
  Line 112:    Expected an assignment or function call and instead saw an expression  no-unused-expressions
........

well, I didn't notice that there was a error about babel settings yesterday, and I found that to solve that problem is just eject and modify webpack settings. Is there any methods to set Babel option compact to false without eject?

Thanks.

Panepo avatar Nov 23 '18 02:11 Panepo

Is there any methods to set Babel option compact to false without eject?

Hmm, not sure about this. Let's wait for maintainers :)

konekoya avatar Nov 23 '18 06:11 konekoya

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

stale[bot] avatar Dec 23 '18 17:12 stale[bot]

Sorry, but we don't really support directly importing minified files. Please put the original files in your project or import this script in your index.html (global scope).

Timer avatar Dec 23 '18 19:12 Timer