mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-15 20:16:39 +02:00
Export properly
This commit is contained in:
parent
7c1a18895e
commit
e8d8f8662e
10
server.js
10
server.js
|
@ -1,13 +1,13 @@
|
|||
let webpack = require('webpack');
|
||||
let WebpackDevServer = require('webpack-dev-server');
|
||||
let config = require('./webpack.config.dev');
|
||||
let opn = require('opn');
|
||||
const webpack = require('webpack');
|
||||
const WebpackDevServer = require('webpack-dev-server');
|
||||
const config = require('./webpack.config.dev');
|
||||
const opn = require('opn');
|
||||
|
||||
new WebpackDevServer(webpack(config), {
|
||||
publicPath: config.output.publicPath,
|
||||
historyApiFallback: true,
|
||||
quiet: true, // lets WebpackDashboard do its thing
|
||||
}).listen(3001, 'localhost', (err, result) => {
|
||||
}).listen(3001, 'localhost', (err) => {
|
||||
if (err) console.log(err);
|
||||
opn('http://localhost:3001');
|
||||
console.log('Listening at localhost:3001');
|
||||
|
|
4795
src/scripts/dist/choices.js
vendored
4795
src/scripts/dist/choices.js
vendored
File diff suppressed because it is too large
Load diff
2
src/scripts/dist/choices.js.map
vendored
2
src/scripts/dist/choices.js.map
vendored
File diff suppressed because one or more lines are too long
2
src/scripts/dist/choices.min.js
vendored
2
src/scripts/dist/choices.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -32,7 +32,7 @@ import './lib/polyfills';
|
|||
/**
|
||||
* Choices
|
||||
*/
|
||||
export default class Choices {
|
||||
class Choices {
|
||||
constructor(element = '[data-choice]', userConfig = {}) {
|
||||
// If there are multiple elements, create a new instance
|
||||
// for each element besides the first one (as that already has an instance)
|
||||
|
@ -2405,3 +2405,6 @@ export default class Choices {
|
|||
}
|
||||
|
||||
Choices.userDefaults = {};
|
||||
|
||||
// We cannot export default here due to Webpack: https://github.com/webpack/webpack/issues/3929
|
||||
module.exports = Choices;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
const path = require('path');
|
||||
const pkg = require('./package.json');
|
||||
const webpack = require('webpack');
|
||||
const wrapperPlugin = require('wrapper-webpack-plugin');
|
||||
const banner = `/*! ${ pkg.name } v${ pkg.version } | (c) ${ new Date().getFullYear() } ${ pkg.author } | ${ pkg.homepage } */ \n`;
|
||||
const WrapperPlugin = require('wrapper-webpack-plugin');
|
||||
|
||||
const banner = `/*! ${pkg.name} v${pkg.version} | (c) ${new Date().getFullYear()} ${pkg.author} | ${pkg.homepage} */ \n`;
|
||||
|
||||
module.exports = (env) => {
|
||||
const minimize = !!(env && env.minimize);
|
||||
|
@ -10,7 +11,7 @@ module.exports = (env) => {
|
|||
const config = {
|
||||
devtool: minimize ? false : 'cheap-module-source-map',
|
||||
entry: [
|
||||
'./src/scripts/src/choices'
|
||||
'./src/scripts/src/choices',
|
||||
],
|
||||
output: {
|
||||
path: path.join(__dirname, '/src/scripts/dist'),
|
||||
|
@ -18,30 +19,44 @@ module.exports = (env) => {
|
|||
publicPath: '/src/scripts/dist/',
|
||||
library: 'Choices',
|
||||
libraryTarget: 'umd',
|
||||
auxiliaryComment: {
|
||||
root: 'Window',
|
||||
commonjs: 'CommonJS',
|
||||
commonjs2: 'CommonJS2',
|
||||
amd: 'AMD',
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
// This has effect on the react lib size
|
||||
'NODE_ENV': JSON.stringify('production'),
|
||||
}
|
||||
NODE_ENV: JSON.stringify('production'),
|
||||
},
|
||||
}),
|
||||
new wrapperPlugin({
|
||||
new WrapperPlugin({
|
||||
header: banner,
|
||||
}),
|
||||
],
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.js$/,
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
loader: 'babel-loader',
|
||||
include: path.join(__dirname, 'src/scripts/src'),
|
||||
options: {
|
||||
babelrc: false,
|
||||
presets: [['es2015', { modules: false }], 'stage-2'],
|
||||
rules: [
|
||||
{
|
||||
enforce: 'pre',
|
||||
test: /\.js?$/,
|
||||
include: path.join(__dirname, 'src/scripts/src'),
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
loader: 'eslint-loader',
|
||||
query: {
|
||||
configFile: '.eslintrc',
|
||||
},
|
||||
},
|
||||
}],
|
||||
{
|
||||
test: /\.js?$/,
|
||||
include: path.join(__dirname, 'src/scripts/src'),
|
||||
exclude: /(node_modules|bower_components)/,
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -50,12 +65,12 @@ module.exports = (env) => {
|
|||
sourceMap: false,
|
||||
mangle: true,
|
||||
output: {
|
||||
comments: false
|
||||
comments: false,
|
||||
},
|
||||
compress: {
|
||||
warnings: false,
|
||||
screw_ie8: true
|
||||
}
|
||||
screw_ie8: true,
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue