Looking for jasmine when building with webpack
See original GitHub issueIssue Description
First, thanks for this. It´s really helpful!
I came across some weird dependecy-errors from jasmine (don´t know if related), since i installed (npm) and required your plugin, and then building with webpack. However, the build itself seems to work. I temporary uninstalled jasmine to prevent unrelated errors and here is what webpack tells me know after building:
Webpack built in 17389ms - ./~/moment-precise-range-plugin/test/node-tests.js
Module not found: Error: Cannot resolve module 'jasmine' in /path/to/project/node_modules/moment-precise-range-plugin/test
resolve module jasmine in /path/to/project/node_modules/moment-precise-range-plugin/test
looking for modules in /path/to/project/node_modules
/path/to/project/node_modules/jasmine doesn't exist (module as directory)
resolve 'file' jasmine in /path/to/project/node_modules
resolve file
/path/to/project/node_modules/jasmine doesn't exist
/path/to/project/node_modules/jasmine.js doesn't exist
/path/to/project/node_modules/jasmine.json doesn't exist
[/path/to/project/node_modules/jasmine]
[/path/to/project/node_modules/jasmine]
[/path/to/project/node_modules/jasmine.js]
[/path/to/project/node_modules/jasmine.json]
I´m kind of confused since this is not happening with any other module. I don´t even find the place where ‘node-tests-js’ is loaded. Funny thing: If i delete the folder test in the modules folder, there´s no error occuring anymore.
It seems it has something to do with your test code or some missing dependencies. Tell me, if i can help you bugfixing.
Or is it my shitty webpack configuration?
import webpack from 'webpack';
import autoprefixer from 'autoprefixer';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import config from '../../config';
module.exports = {
entry: {
main: `./${config.srcDir}/main.js`,
vendor: `./${config.srcDir}/vendor.js`
},
output: {
path: `./${config.buildDir}`,
filename: GLOBAL.environment === 'production' ? "[name]_[hash].js" : "[name].js",
chunkFilename: "[chunkhash].js",
publicPath: config.build.DEPLOY_BASE
},
module: {
loaders: [
{
test: /\.js$/,
loader: `babel!preprocess?${JSON.stringify(config.build)}`,
exclude: /(node_modules|bower_components)/
},
{
test: /\.html$/,
loader: `html!preprocess?${JSON.stringify(config.build)}`
},
{
test: /\.s?css$/,
loaders: ['exports?module.exports.toString()', 'css', 'postcss-loader', 'sass']
},
{
test: /\.(png|gif)$/i,
loaders: [
'url?limit=10000',
'image-webpack?{bypassOnDebug:true, optimizationLevel:7, interlaced:true}'
]
},
{
test: /\.(jpe?g)$/i,
loaders: ['file', 'image-webpack?{bypassOnDebug:true, progressive: true}']
},
{
test: /\.(mp4|ogv|webm)$/i,
loader: 'file'
},
// from https://shellmonger.com/2016/01/22/working-with-fonts-with-webpack/
{
test: /\.(eot|ttf|woff|woff2|svg)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file?name=fonts/[name].[ext]'
}
]
},
resolve: {
extensions: ['','.js','.json']
},
htmlLoader: {
caseSensitive: true,
minimize: false,
attrs: ['img:src', 'video:src', 'source:src']
},
postcss: [ autoprefixer({ browsers: ['last 2 versions'] }) ],
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js', Infinity),
new HtmlWebpackPlugin({
template: `./${config.srcDir}/index.html`
}),
new HtmlWebpackPlugin({
filename: 'demo.html',
template: `./${config.srcDir}/demo.html`
}),
new webpack.optimize.UglifyJsPlugin({
comments: false,
mangle: false
})
],
devtool: GLOBAL.environment === 'production' ? 'source-map' : 'eval-source-map',
debug: !(GLOBAL.environment === 'production')
};
Thanks and regards, Stefan
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:10 (3 by maintainers)
Hi there! Doest’n suit for me, problem still remains. Also with webpack. I’m using moment-precise-range-plugin@1.2.0 on npm v3.8.3 and node v5.10.1
I think
test
folder ignore in.npmignore
file or add files field in moment-precise-range/package.jsonExample