This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
Production build fails with ES6 javascript files in the project #158
Closed
Description
Is this a bug report?
Yes
Can you also reproduce the problem with npm 4.x?
Didn't try.
Which terms did you search for in User Guide?
Basically if you follow the step "3. If the dependency is small enough, copy it to your src/ folder and treat it as application code." in react-scripts-ts project you get this bug.
Environment
npm ls react-scripts-ts
(if you haven’t ejected): react-scripts-ts@2.6.0node -v
: v8.2.1npm -v
: 5.3.0yarn --version
(if you use Yarn): 0.27.5npm ls react-scripts-ts
(if you haven’t ejected):test@0.1.0 /private/tmp/test └── react-scripts-ts@2.6.0
Then, specify:
- Operating system: macos 10.11.6 (15G1611)
- Browser and version (if relevant): N/A
Steps to Reproduce
Add an import of ES6 javascript (.js
) file and run build:
create-react-app --scripts-version=react-scripts-ts test
cd test
echo 'export default class Test {}' > src/Test.js
- add to
src/App.tsx
:import Test from './Test'; console.log('Test', Test);
yarn run build
In the real-world example I encountered this the javascript file is a dependency that I can only copypaste into the project as it is not distributed otherwise.
Expected Behavior
Successful production build.
Actual Behavior
Development server works, but production build fails.
yarn run build
:
yarn run v0.27.5
$ react-scripts-ts build
Creating an optimized production build...
Warning: The 'no-use-before-declare' rule requires type information.
ts-loader: Using typescript@2.4.2 and /private/tmp/test/tsconfig.json
Failed to compile.
static/js/main.ff9586e3.js from UglifyJs
Unexpected token: name (Test) [./~/source-map-loader!./src/Test.js:1,0][static/js/main.ff9586e3.js:21758,6]
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The code on line 21758 is class Test {
-- the code around it:
/* 178 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
class Test {
}
/* harmony export (immutable) */ __webpack_exports__["a"] = Test;
/***/ }),
Metadata
Metadata
Assignees
Labels
No labels