I am using angular-cli": "1.0.0-beta.25.5 and I added "assets":["assets"] to my angular-cli.json, and got other errors. This was suppose to be the fix of a prior bug that is closed now.
ERROR in ./src/app/shared/forms/input/select2/select2.directive.ts Module not found: Error: Can't resolve 'script' in 'web/src/app/shared/forms/input/select2' BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders. You need to specify 'script-loader' instead of 'script'.
When I run ng build I get:
ERROR in ./src/polyfills.ts Module not found: Error: Can't resolve imports in /web/src BREAKING CHANGE: It's no longer allowed to omit the -loader' suffix when using loaders. You need to specify imports-loader' instead of imports. @ ./src/polyfills.ts 28:0-60 @ ./src/main.ts @ multi main`
This started happening when I updated my project ncu -u and than it started to complain about patterns.map is not a function. I found out it was already reported as a bug so I replaced "assets":"assets" to "assets":["assets"] in my angular-cli-json file, now I am getting the posted error.
Polyfills.ts
`import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
window['jQuery'] = require('jquery');
window['$'] = window['jQuery'];
// import 'jquery-ui-npm/jquery-ui.min.js'
require('bootstrap/js/tooltip.js'); // required for X-editable
require('bootstrap/js/popover.js'); // required for X-editable
require('bootstrap/js/dropdown.js'); // required for bootstrap-colorpicker
require('bootstrap/js/tab.js'); //
require('bootstrap/js/modal.js'); //
window['moment'] = require('moment');
import 'imports?jQuery=jquery!jquery-color/jquery.color.js'
require('smartadmin-plugins/notification/SmartNotification.min.js');`
That is because you need to change this line:
import 'imports?jQuery=jquery!jquery-color/jquery.color.js'
to
import 'imports-loader?jQuery=jquery!jquery-color/jquery.color.js'
As the error message states, webpack no longer automatically resolves the "-loader" suffix.
@mhheise
Thank you for your efforts but that did not work. So far I have tried the following since my post:
npm uninstall bootstrap-loader, then npm install bootstrap-loader@latest
npm install imports-loader
Added this to my package.json "resolve-url-loader": "1.6.1" then npm install
ncu says I am up to date with my dependencies, but since I added resolve-url-loader": "1.6.1 I had to resolve the warnings by npm install <dependency needed>. However I am still getting the same error.
NOTE This started happening when I updated my project ncu -u and than it started to complain about patterns.map is not a function. I found out it was already reported as a bug so I replaced "assets":"assets", to"assets":["assets"], in my angular-cli-json file, now I am getting the posted error.
@drewjocham
You have also to change imports like:
'script!select2/dist/js/select2.min.js'
to:
'script-loader!select2/dist/js/select2.min.js'
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
@drewjocham
You have also to change imports like:
'script!select2/dist/js/select2.min.js'to:
'script-loader!select2/dist/js/select2.min.js'