Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Resolved config doesn't contain a resolve configuration #24

Open
benduran opened this issue Sep 7, 2016 · 17 comments
Open

Resolved config doesn't contain a resolve configuration #24

benduran opened this issue Sep 7, 2016 · 17 comments
Labels

Comments

@benduran
Copy link

benduran commented Sep 7, 2016

I've seen this issue in a closed github issue, but I just installed v2.0.0 of this plugin and received the same issue. Here are my configs for reference:

Webpack.config

const config = Object.assign({
    entry: entryPoint,
    output: {
        filename: outputFileName,
        library: libraryName,
        libraryTarget: 'umd',
        umdNamedDefine: true
    },
    module: {
        loaders: [{
            test: /\.(jsx|js)$/,
            exclude: /(node_modules)/,
            loader: 'babel',
            query: {
                presets: ['es2015', 'react'],
                plugins: ['transform-object-rest-spread', 'transform-class-properties']
            }
        }, {
            test: /\.(styl|css)$/,
            loader: 'style-loader!css-loader!postcss-loader!stylus-loader'
        }, {
            test: /\.(woff2|woff|eot|ttf|svg|otf|png|jpg|jpeg)$/,
            exclude: /(node_modules)/,
            loader: 'url-loader'
        }]
    },
    postcss: function () {
        return [require('autoprefixer')({
            browsers: [
                'last 2 versions'
            ]
        })];
    },
    resolve: {
        alias: {
            'jquery-ui': 'jquery-ui/ui/widgets',
            'sharedScript': path.resolve('./shared/script')
        },
        extensions: ['', '.jsx', '.js', '.styl']
    },
    plugins: [new webpack.DefinePlugin({
        'process.env': {
            NODE_ENV: '"development"',
            UNITY_ENV: '"production"', // If you're building a DEV build from the Unity interface, change this to "development",
            BUILD_VERSION: '"' + readVersionNumber(args) + '"',
            JAVASCRIPT_INTERFACE_NAME: '"' + (buildForRP ? 'ProspectorJavascriptInterface' : 'OnsightJavascriptInterface') + '"',
            LIBRARY_NAME: '"' + libraryName + '"'
        }
    })]
}, production ? {
    plugins: [new webpack.optimize.UglifyJsPlugin({
        compress: {
            sequences: true,
            booleans: true,
            warnings: false,
            drop_debugger: true,
            drop_console: true
        },
        mangle: {
            except: ['$']
        },
        comments: false
    }), new webpack.DefinePlugin({
        'process.env': {
            NODE_ENV: '"production"',
            UNITY_ENV: '"production"', // If you're building a DEV build from the Unity interface, change this to "development",
            BUILD_VERSION: '"' + readVersionNumber(args) + '"',
            JAVASCRIPT_INTERFACE_NAME: '"' + (buildForRP ? 'ProspectorJavascriptInterface' : 'OnsightJavascriptInterface') + '"',
            LIBRARY_NAME: '"' + libraryName + '"'
        }
    })]
} : {});

module.exports = config;
package.json babel config
"babel": {
    "presets": [
      "es2015",
      "react"
    ],
    "plugins": [
      "transform-object-rest-spread",
      "transform-class-properties",
      ["babel-plugin-webpack-alias", { "config": "./webpack.config.js", "findConfig": true }]
    ]
  }

Error, for reference

throw err;
        ^

Error: D:/web/webpack.config.js: The resolved config file doesn't contain a resolve configuration
@benduran
Copy link
Author

benduran commented Sep 7, 2016

And go figure, as soon as I post this, I figure out the problem.

@benduran benduran closed this as completed Sep 7, 2016
@piersadrian
Copy link

@benduran what was the issue? Having the same problem here.

@benduran
Copy link
Author

benduran commented Sep 7, 2016

@piersadrian For me, it's a problem that is harder to correct. My build is heavily reliant on CLI arguments, which is something mocha doesn't handle out of the box (meaning pass-through). My webpack.config wasn't being transformed correctly because of this.

@adriantoine adriantoine reopened this Sep 8, 2016
@adriantoine
Copy link
Contributor

Hi! If this is a problem, use v1.9.0 until I fix that. I released this one as a major release so that npm doesn't auto install this version for people having "^1.9.0" in their package.json.

I'll look into that as soon as I can.

@adriantoine adriantoine added the bug label Sep 8, 2016
@adriantoine
Copy link
Contributor

I can't really reproduce that, @piersadrian can you give me more info about your dev environment and configuration?
Thanks!

@adriantoine
Copy link
Contributor

@piersadrian are you using v2.0.0? This issue was occurring with v1.8.3 but I thought I fixed it in v2.0.0.

@adriantoine
Copy link
Contributor

I can't replicate the issue at the moment and I can't investigate without more information, so I will close that for now, feel free to comment if you can provide more info.

@vladinator1000
Copy link

vladinator1000 commented Oct 7, 2016

+1 having the same issue,
.babelrc:

{
  "presets": ["react", "es2015", "stage-1", "stage-0"],
  "plugins": [
    "react-hot-loader/babel",
    [
        "babel-plugin-webpack-alias",
        {
            "config": "webpack.config.dev.js",
            "findConfig": true
        }
    ]
  ]
}

webpack.config.dev.js:

const path = require('path');
const webpack = require('webpack');

module.exports = {
    // ...
    resolve: {
        modulesDirectories: ['node_modules', 'client', 'components', 'stores'],
        extensions: ['', '.js', '.scss', 'svg', 'ttf', 'woff', 'eot'],
        root: [path.join(__dirname, './client')],

        alias: {
            assets: path.resolve(__dirname, './client/assets'),
            stylesheets: path.resolve(__dirname, './client/stylesheets'),
            client: path.resolve(__dirname, './client'),
            components: path.resolve(__dirname, './client/components'),
            actions: path.resolve(__dirname, './client/actions'),
            reducers: path.resolve(__dirname, './client/reducers'),
        },
    },
};

EDIT: To anyone having this problem: try using path.join() instead of path.resolve(). I think that's what causing it.

@adriantoine adriantoine reopened this Oct 7, 2016
@benduran
Copy link
Author

benduran commented Oct 7, 2016

@savovs Thanks for pointing this out. I ended up running into this issue again yesterday when setting up a new test project. Rolling back to 1.8.2 fixed the issue for me, though that version is quite old now.

I'll upgrade back to the current version and try swapping over to path.join and report my findings

@adriantoine
Copy link
Contributor

@benduran @savovs don't worry about using v1.8.2, the library hasn't changed much since then. I'll have a look at that as soon as I can.

@McChen
Copy link

McChen commented Oct 12, 2016

+1

Having the same issue, with similar configuration, on version 2.1.1. Rolling back to 2.1.0 works for me.

@adriantoine
Copy link
Contributor

Thanks for the feedback, at the moment the only way to fix this seems to rollback to 1.8.2.

I don't have time to work on this for now. Can anyone make a small repo which replicates this issue?

@vladinator1000
Copy link

@McChen have you tried changing path.resolve()s to path.join()s in your webpack config? That fixed the issue for me.

@McChen
Copy link

McChen commented Oct 12, 2016

@savovs I was using path.join() to begin with actually. 2.1.0 but had to rollback all the way to 1.8.2 on Jenkins.

@pawelrychlik
Copy link

yep, 1.8.2 works like a charm.

@kwelch
Copy link

kwelch commented Oct 21, 2016

@pawelrychlik I am trying this with 1.8.2 but it is not working are you using path.join or path.resolve

@pawelrychlik
Copy link

@kwelch path.join does the job for me. A snippet from my webpack config:

    alias: {
      'config': path.join(__dirname, './config/index.js'),
    },

And I'm explicitly using exactly "1.8.2" in package.js, with no ^ or ~.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants