{"action":"created","issue":{"url":"https://api.github.com/repos/PrismJS/prism/issues/1020","repository_url":"https://api.github.com/repos/PrismJS/prism","labels_url":"https://api.github.com/repos/PrismJS/prism/issues/1020/labels{/name}","comments_url":"https://api.github.com/repos/PrismJS/prism/issues/1020/comments","events_url":"https://api.github.com/repos/PrismJS/prism/issues/1020/events","html_url":"https://github.com/PrismJS/prism/issues/1020","id":174817946,"number":1020,"title":"Using non-default Prism languages with Webpack","user":{"login":"jswny","id":3282078,"avatar_url":"https://avatars.githubusercontent.com/u/3282078?v=3","gravatar_id":"","url":"https://api.github.com/users/jswny","html_url":"https://github.com/jswny","followers_url":"https://api.github.com/users/jswny/followers","following_url":"https://api.github.com/users/jswny/following{/other_user}","gists_url":"https://api.github.com/users/jswny/gists{/gist_id}","starred_url":"https://api.github.com/users/jswny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jswny/subscriptions","organizations_url":"https://api.github.com/users/jswny/orgs","repos_url":"https://api.github.com/users/jswny/repos","events_url":"https://api.github.com/users/jswny/events{/privacy}","received_events_url":"https://api.github.com/users/jswny/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-02T18:12:37Z","updated_at":"2016-09-09T16:15:46Z","closed_at":null,"body":"I'm trying to use Prism with Webpack. I've installed Prism with NPM, and I am importing Prism in my `entry.js` like so: `import 'prismjs'`. This works fine for highlighting the default languages like JavaScript, however, I have some Scala snippets that I need to highlight, but I cannot figure out how to include the Scala component. I've tried the following in my `entry.js`:\r\n```\r\nimport 'prismjs';\r\nimport 'prismjs/components/prism-scala.js';\r\n```\r\n\r\nHowever this leaves me with the following error in the browser console: `prism.js:79 Uncaught TypeError: Cannot set property 'keyword' of undefined`. How can I import these other languages so that they can be included with the client-side Prism instance I'm using with Webpack?'\r\n\r\nFor reference, I'm just importing the resulting Webpack bundle into my page and then using the `language-scala` class on my snippets.\r\n\r\nwebpack.conf.js:\r\n```\r\n{\r\n  entry: {\r\n    home: './lib/client/js/pages/home.js',\r\n    projects: './lib/client/js/pages/projects.js',\r\n    post: './lib/client/js/pages/post.js'\r\n  },\r\n  output: {\r\n    filename: '[name].js',\r\n    publicPath: '/webpack/'\r\n  },\r\n  devtool: 'source-map',\r\n  module: {\r\n    loaders: [\r\n      { test: /\\.css$/, loader: 'style!css?sourceMap' },\r\n      { test: /\\.scss$/, loaders: ['style', 'css?sourceMap', 'sass'] },\r\n      { test: /\\.(eot|svg|ttf|woff(2)?)(\\?v=\\d+\\.\\d+\\.\\d+)?/, loader: 'url' },\r\n      {\r\n        test: /\\.js$/,\r\n        exclude: /(node_modules)/,\r\n        loader: 'babel',\r\n        query: {\r\n          presets: ['es2015', 'stage-2']\r\n        }\r\n      }\r\n    ]\r\n  },\r\n  sassLoader: {\r\n    sourceMap: true\r\n  },\r\n  plugins: [\r\n    new commons('commons.js', ['home', 'projects', 'post'])\r\n  ]\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/PrismJS/prism/issues/comments/245961624","html_url":"https://github.com/PrismJS/prism/issues/1020#issuecomment-245961624","issue_url":"https://api.github.com/repos/PrismJS/prism/issues/1020","id":245961624,"user":{"login":"jswny","id":3282078,"avatar_url":"https://avatars.githubusercontent.com/u/3282078?v=3","gravatar_id":"","url":"https://api.github.com/users/jswny","html_url":"https://github.com/jswny","followers_url":"https://api.github.com/users/jswny/followers","following_url":"https://api.github.com/users/jswny/following{/other_user}","gists_url":"https://api.github.com/users/jswny/gists{/gist_id}","starred_url":"https://api.github.com/users/jswny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jswny/subscriptions","organizations_url":"https://api.github.com/users/jswny/orgs","repos_url":"https://api.github.com/users/jswny/repos","events_url":"https://api.github.com/users/jswny/events{/privacy}","received_events_url":"https://api.github.com/users/jswny/received_events","type":"User","site_admin":false},"created_at":"2016-09-09T16:15:46Z","updated_at":"2016-09-09T16:15:46Z","body":"@getsnoopy Using Webpack with \r\n```\r\nvar prism = require('prismjs');\r\nrequire('prismjs/components/prism-scala');\r\n```\r\nin my `entry.js` and then using the resulting bundle in my page I still cannot get syntax highlighting to work with Scala. JS syntax highlighting works fine, however my Scala snippets do not.\r\n\r\nAdditionally, the page is completely broken when I try to use your suggestion in the ES6 syntax style with Babel like so:\r\n```\r\nimport 'prismjs';\r\nimport 'prismjs/components/prism-scala';\r\n```\r\nor\r\n```\r\nimport prism from 'prismjs';\r\nimport 'prismjs/components/prism-scala';\r\n```\r\nin my `entry.js` file."}}
{"actor":{"display_login":"jswny"}}