导入'./../public/js/bootstrap-4.1.3.min.js'的webpack构建错误;
i 「wdm」: Compiling...
× 「wdm」: Hash: ada562f2a3ee6ec3a27d
Version: webpack 4.31.0
Time: 190ms
Built at: 05/10/2019 2:19:31 PM
Asset Size Chunks Chunk Names
favicon.ico 1.12 KiB [emitted]
index.html 2.09 KiB [emitted]
+ 1 hidden asset
Entrypoint main = bundle-reactapp.js
[./src/index.js] 1.03 KiB {main} [built]
+ 92 hidden modules
ERROR in ./public/js/bootstrap-4.1.3.min.js
Module not found: Error: Can't resolve 'jquery' in 'C:\Users\vis\Documents\MyApp\reactapp\public\js'
@ ./public/js/bootstrap-4.1.3.min.js 9:125-142 9:212-257
@ ./src/index.js
ERROR in ./public/js/bootstrap-4.1.3.min.js
Module not found: Error: Can't resolve 'popper.js' in 'C:\Users\vis\Documents\MyApp\reactapp\public\js'
@ ./public/js/bootstrap-4.1.3.min.js 9:144-164 9:212-257
@ ./src/index.js
Child html-webpack-plugin for "index.html":
1 asset
Entrypoint undefined = index.html
1 module
I 「wdm」: Failed to compile.
//src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './../public/css/bootstrap-4.1.3.min.css';
import './../public/js/jquery-3.3.1.min.js';
import './../public/js/popper-1.14.3.min.js';
import './../public/js/bootstrap-4.1.3.min.js';
无论哪种方式,我都需要将这些.js文件捆绑到内部版本中,以便它们在浏览器中有效。