framework icon indicating copy to clipboard operation
framework copied to clipboard

Problem when using i18n and webpack

Open mfraiss opened this issue 9 years ago • 3 comments

I'm submitting a bug report

  • Library Version: major.minor.patch-pre

Please tell us about your environment:

  • Operating System: Windows [10]

  • Node Version: v7.9.0

  • NPM Version: v4.2.0

  • Aurelia CLI OR JSPM OR Webpack AND Version webpack 2.4.1

  • Language: TypeScript 2.2

Current behavior: We are using the i18n plugin of aurelia, and webpack does not bundle it, we get the following error:

WARNING in ./~/typings/dist/bin.js Module parse failed: D:\Projekte\CNCT\b2b_frontend\src\Connect.B2B.WebBackend\node_modules\babel-loader\lib\index.js?cacheDirectory=true!D:\Projekte\CNCT\b2b_frontend\src\Connect.B2B.WebBackend\node_modules\typings\dist\bin.js Unexpected character '#' (1:0) You may need an appropriate loader to handle this file type. | #!/usr/bin/env node | "use strict";Object.defineProperty(exports,"__esModule",{value:true});var minimist=require("minimist");var wordwrap=require("wordwrap");var hasUnicode=require("has-unicode");var path_1=require("path");var chalk=require("chalk");var updateNotifier=require("update-notifier");var extend=require("xtend");var events_1=require("events");var cli_1=require("./support/cli");var aliases_1=require("./aliases");var pkg=require('../package.json');var unicodeConfig=process.env['TYPINGS_CONFIG_UNICODE']||process.env['NPM_CONFIG_UNICODE'];var argv=minimist(process.argv.slice(2),{boolean:['version','save','saveDev','savePeer','global','verbose','production','unicode'],string:['cwd','out','name','source','offset','limit','sort','loglevel'],alias:{global:['G'],version:['v'],save:['S'],saveDev:['save-dev','D'],savePeer:['savePeer','P'],verbose:['V'],out:['o'],help:['h']},default:{unicode:unicodeConfig?isTrue(unicodeConfig):hasUnicode(),production:process.env['NODE_ENV']==='production'}});function isTrue(value){return value==='1'||value==='true';}var cwd=argv.cwd?path_1.resolve(argv.cwd):process.cwd();var emitter=new events_1.EventEmitter();var args=extend(argv,{emitter:emitter,cwd:cwd});if(argv.loglevel){cli_1.setLoglevel(argv.loglevel);}updateNotifier({pkg:pkg}).notify();exec(args);emitter.on('enoent',function(_a){var path=_a.path;cli_1.logWarning("Path \""+path+"\" is missing",'enoent');});emitter.on('hastypings',function(_a){var name=_a.name,typings=_a.typings;cli_1.logWarning("Typings for \""+name+"\" already exist in \""+path_1.relative(cwd,typings)+"\". You should "+"let TypeScript resolve the packaged typings and uninstall the copy installed by Typings",'hastypings');});emitter.on('postmessage',function(_a){var message=_a.message,name=_a.name;cli_1.logInfo(name+": "+message,'postmessage');});emitter.on('badlocation',function(_a){var raw=_a.raw;cli_1.logWarning("\""+raw+"\" is mutable and may change, consider specifying a commit hash",'badlocation');});emitter.on('deprecated',function(_a){var date=_a.date,raw=_a.raw,parent=_a.parent;if(parent==null||parent.raw==null){cli_1.logWarning(date.toLocaleDateString()+": \""+raw+"\" is deprecated (updated, replaced or removed)",'deprecated');}});emitter.on('prune',function(_a){var name=_a.name,global=_a.global,resolution=_a.resolution;var suffix=chalk.gray(" ("+resolution+")"+(global?' (global)':''));cli_1.logInfo(""+name+suffix,'prune');});emitter.on('resolve',function(_a){var src=_a.src,name=_a.name;cli_1.setStatus("Resolving \""+name+"\" from \""+src+"\"");});emitter.on('resolved',function(_a){var name=_a.name;cli_1.setStatus("Resolved \""+name+"\"");});emitter.on('compiledependency',function(_a){var name=_a.name;cli_1.setStatus("Compiling \""+name+"\"");});function exec(options){if(options._.length){var command=aliases_1.aliases[options._[0]];var args_1=options._.slice(1);if(command!=null){if(options.help){return console.log(command.help());}return cli_1.handle(command.exec(args_1,options),options);}}else if(options.version){console.log(pkg.version);return;}var wrap=wordwrap(4,80);console.log("\nUsage: typings <command>\n\nCommands:\n"+wrap(Object.keys(aliases_1.aliases).sort().join(', '))+"\n\ntypings <command> -h Get help for <command>\ntypings <command> -V Enable verbose logging\n\ntypings --version Print the CLI version\n [--loglevel] <level> Set the log level (\"debug\", info\", \"warn\", \"error\" or \"silent\")\n\ntypings@"+pkg.version+" "+path_1.join(__dirname,'..')+"\n");}//# sourceMappingURL=bin.js.map @ ./Client/AdminApp ^\.\/.*$ @ ./~/aurelia-bootstrapper-webpack/~/aurelia-loader-webpack/dist/commonjs/aurelia-loader-webpack.js @ ./~/aurelia-bootstrapper-webpack/dist/commonjs/aurelia-bootstrapper-webpack.js @ multi ./Client/AdminApp/main.ts aurelia-bootstrapper-webpack

package.json { "name": "myProject", "version": "0.1.0", "private": true, "scripts": { "dll": "webpack --config webpack.dll.config.js", "watch": "webpack --watch --config webpack.config.js" }, "devDependencies": { "aurelia-webpack-plugin": "^1.2.0", "awesome-typescript-loader": "^3.1.2", "babel-core": "^6.22.1", "babel-loader": "^6.2.10", "babel-preset-es2015": "^6.22.0", "css-loader": "^0.27.3", "file-loader": "^0.10.0", "html-loader": "^0.4.4", "html-webpack-plugin": "^2.28.0", "node-sass": "^4.5.0", "resolve-url-loader": "^2.0.2", "sass-loader": "^6.0.3", "style-loader": "^0.16.0", "typescript": "^2.1.6", "url-loader": "^0.5.7", "webpack": "^2.2.1" }, "dependencies": { "aurelia-bootstrapper-webpack": "^1.1.0", "aurelia-dialog": "^1.0.0-beta.3.0.1", "aurelia-framework": "^1.0.8", "aurelia-history-browser": "^1.0.0", "aurelia-i18n": "^1.4.0", "aurelia-bootstrap": "^0.1.17", "velocity-animate": "^1.5.0", "tether": "^1.4.0", "aurelia-loader-webpack": "^2.0.0", "aurelia-logging-console": "^1.0.0", "aurelia-templating-binding": "^1.2.0", "aurelia-templating-resources": "^1.2.0", "aurelia-templating-router": "^1.0.1", "aurelia-validation": "^1.0.0", "babel-polyfill": "^6.22.0", "typings": "^2.1.1", "i18next-xhr-backend": "^1.4.1", "bundle-loader": "^0.5.5", "json-loader": "^0.5.4" } }

Expected/desired behavior: Correct bundling when using webpack

mfraiss avatar Apr 20 '17 16:04 mfraiss

Additional comment: typings has been manually installed by "typings install"

mfraiss avatar Apr 20 '17 16:04 mfraiss

@mfraiss can you share your example? A repo link or uploaded zip? I see no way to help you with the provided information :(

zewa666 avatar Apr 21 '17 04:04 zewa666

Unfortunately i cannot share the example. We figured out the problem meanwhile: There was an error in our type-script configuration file and missing dependency npm's. Way complicated.

mfraiss avatar Apr 21 '17 12:04 mfraiss