babel-plugin-webpack-alias: Resolved config doesn't contain a resolve configuration

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

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

@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 ~.