简体   繁体   English

文件名超过三个点时Webpack出现问题

[英]Trouble with Webpack when filename has more than three dots

I thinhk I have a really rare trouble when i do npm webpack --progress 我thinhk当我执行npm webpack --progress时,我遇到了非常罕见的麻烦

Before using datatables I had no error with vendor js files. 在使用数据表之前,供应商js文件没有错误。 (this code is in entry property in webpack.config.js) (此代码位于webpack.config.js中的entry属性中)

vendor: [
        './src/resources/tema/js/jquery.js',
        './src/resources/tema/js/bootstrap.min.js,
]

After importing jQuery DataTable it generate with errors. 导入jQuery DataTable后,它会生成错误。 This errors does not be specific. 此错误不是特定的。 literally it does no gave relevant information 从字面上看,它没有提供任何相关信息

vendor: [
        './src/resources/tema/js/jquery.js',
        './src/resources/tema/js/bootstrap.min.js',
        './src/resources/DataTables-1.10.13/media/js/jquery.dataTables.js',
        './src/resources/DataTables-1.10.13/media/js/dataTables.buttons.min.js',
        './src/resources/DataTables-1.10.13/media/js/buttons.flash.min.js',
        './src/resources/DataTables-1.10.13/media/js/jszip.min.js',
        './src/resources/DataTables-1.10.13/media/js/pdfmake.min.js',
        './src/resources/DataTables-1.10.13/media/js/vfs_fonts.js',
        './src/resources/DataTables-1.10.13/media/js/buttons.html5.min.js',
        './src/resources/DataTables-1.10.13/media/js/buttons.print.min.js'
    ]

The rare is that when I comment the lines where the filename has three dots, webpack generate without error. 罕见的是,当我注释文件名包含三个点的行时,webpack生成时不会出错。 Someone with the same problem. 有人遇到同样的问题。

Thanks in advance. 提前致谢。

Some of the modules you're using depend on npm packages. 您使用的某些模块取决于npm软件包。 It seems that you need datatables.net and datatables.net-buttons . 似乎您需要datatables.netdatatables.net-buttons

You can install them with: 您可以使用以下方法安装它们:

npm install --save datatables.net datatables.net-buttons

You should also consider not using the minified dependencies, but the npm modules instead. 您还应该考虑不使用最小化的依赖项,而是使用npm模块。 This makes dependency management easier, so you can easily upgrade or remove them. 这使依赖性管理更加容易,因此您可以轻松升级或删除它们。 See DataTables - NPM packages for the instructions. 有关说明,请参见DataTables-NPM软件包 It also makes debugging easier as you'll get meaningful errors. 当您遇到有意义的错误时,它也使调试更加容易。 Webpack can be used to minify/uglify your entire code, including dependencies, for your production build. Webpack可以用于最小化/拼合您的整个代码,包括依赖关系,用于生产构建。 For more information see Building for Production . 有关更多信息,请参见生产建设

Just a hint for the use with webpack: If you add any module to the vendor entry array, it will also resolve it correctly. 只是与webpack一起使用的提示:如果将任何模块添加到vendor条目数组,它也会正确解析。 So every module you would import with require you can specify as an entry point as well, without needing the concrete path. 因此,要导入的每个模块都require您也可以指定为入口点,而无需具体路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM