-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use with Webpack? #90
Comments
I haven't tried it with Webpack myself. But I think it would work by following the browserify example. https://github.com/pc035860/angular-highlightjs/blob/master/with-browserify/scripts/app.js var angular = require('angular');
angular
.module('exampleApp', [
require('../../angular-highlightjs')
])
.controller('MainCtrl', require('./main-ctrl')); Since the UMD version of angular-highlightjs actually returns just a module name string, this can be rewritten like this. // in ES6, untested
import angular from 'angular';
import hljsModule from 'angular-highlightjs';
angular
.module('exampleApp', [hljsModule])
.controller('MainCtrl', require('./main-ctrl')); If you're still having issues, let me know. |
I tried your solution @pc035860 but it fails like that:
Do you have any idea what I shall do in order to fix that? |
I got it working but I had to disable AMD using the Webpack import-loader: environment.loaders.append('angular-highlightjs', {
test: require.resolve('angular-highlightjs'),
loader: 'imports-loader?define=>false'
}) |
I've installed this package via npm, added the variants of require statements I've seen in the issues, and added the module within my angular modules dependency list. Is that it? I get a console error that the package cannot be found. It looks like I should just have to include angular-highlightjs dependency and it'll pull in highlight.js. I may be missing something, but it'd be nice to have concise documentation for the various methods of pulling in dependencies. I am also not a Webpack expert, so that could be it too.
Thanks
The text was updated successfully, but these errors were encountered: