Skip to content

Instantly share code, notes, and snippets.

@nginnever
Created February 10, 2016 18:07
Show Gist options
  • Select an option

  • Save nginnever/bd33e0fb49fbcba88d1b to your computer and use it in GitHub Desktop.

Select an option

Save nginnever/bd33e0fb49fbcba88d1b to your computer and use it in GitHub Desktop.
Webpack noParse example for node-forge build
module.exports = function (config) {
var path = require('path')
var node_modules_dir = path.join(__dirname, 'node_modules')
var deps = [
'path-to-your-bundle-file/forge.bundle.js'
]
config.set({
basePath: '',
frameworks: ['mocha'],
files: [
'tests/test-core/browser.js'
],
preprocessors: {
'tests/test-core/*': ['webpack']
},
webpack: {
resolve: {
extensions: ['', '.js', '.json'],
alias: {'node-forge': node_modules_dir+'/path-to-your-bundle-file/forge.bundle.js' }
},
externals: {
fs: '{}'
},
node: {
Buffer: true
},
module: {
loaders: [
{ test: /\.json$/, loader: 'json' }
],
noParse: []
},
},
webpackMiddleware: {
noInfo: true,
stats: {
colors: true
}
},
reporters: ['spec'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: process.env.TRAVIS ? ['Firefox'] : ['Chrome'],
singleRun: true
})
deps.forEach(function (dep) {
var depPath = path.resolve(node_modules_dir, dep)
config.webpack.module.noParse.push(depPath)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment